Merge pull request #79 from Neur0toxine/update-test-json-scanner

update record scanner for tests
This commit is contained in:
Pavel 2024-09-26 14:30:26 +03:00 committed by GitHub
commit 78fadaa520
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -11,11 +11,11 @@ import (
type LogRecord struct {
LevelName string `json:"level_name"`
DateTime null.Time `json:"datetime"`
Caller string `json:"caller"`
Message string `json:"message"`
Handler string `json:"handler,omitempty"`
Connection string `json:"connection,omitempty"`
Account string `json:"account,omitempty"`
StreamID string `json:"streamId"`
Context map[string]interface{} `json:"context,omitempty"`
}

View File

@ -26,7 +26,7 @@ func (t *JSONRecordScannerTest) newPredefined() *JSONRecordScanner {
return t.new([]string{strings.ReplaceAll(`{
"level_name": "ERROR",
"datetime": "2024-06-07T13:49:17+03:00",
"caller": "handlers/account_middleware.go:147",
"streamId": "1",
"message": "Cannot add account",
"handler": "handlers.addAccount",
"connection": "https://fake-uri.retailcrm.pro",
@ -44,7 +44,7 @@ func (t *JSONRecordScannerTest) assertPredefined(record LogRecord) {
t.Assert().True(record.DateTime.Valid)
t.Assert().Equal(ts, record.DateTime.Time)
t.Assert().Equal("ERROR", record.LevelName)
t.Assert().Equal("handlers/account_middleware.go:147", record.Caller)
t.Assert().Equal("1", record.StreamID)
t.Assert().Equal("Cannot add account", record.Message)
t.Assert().Equal("handlers.addAccount", record.Handler)
t.Assert().Equal("https://fake-uri.retailcrm.pro", record.Connection)