mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Test for default value for answer time in cdrsql
This commit is contained in:
committed by
Dan Christian Bogos
parent
5cbd7e6e5c
commit
a5bb814426
@@ -686,7 +686,7 @@ func TestCDRAsCDRsql(t *testing.T) {
|
||||
Subject: "1001",
|
||||
Destination: "+4986517174963",
|
||||
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC),
|
||||
AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
|
||||
AnswerTime: utils.TimePointer(time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC)),
|
||||
Usage: cdr.Usage.Nanoseconds(),
|
||||
Cost: cdr.Cost,
|
||||
ExtraFields: utils.ToJSON(cdr.ExtraFields),
|
||||
@@ -716,7 +716,7 @@ func TestCDRNewCDRFromSQL(t *testing.T) {
|
||||
Subject: "1001",
|
||||
Destination: "+4986517174963",
|
||||
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC),
|
||||
AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
|
||||
AnswerTime: utils.TimePointer(time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC)),
|
||||
Usage: 10000000000,
|
||||
Cost: 1.01,
|
||||
RequestType: utils.MetaRated,
|
||||
|
||||
@@ -21,6 +21,7 @@ package engine
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -168,3 +169,60 @@ func TestModelGetAccountActionId(t *testing.T) {
|
||||
t.Errorf("\nExpected <%+v> ,\nreceived <%+v>", exp, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestModelsAsMapStringInterface(t *testing.T) {
|
||||
testCdrSql := CDRsql{
|
||||
ID: 1,
|
||||
Cgrid: "testCgrID1",
|
||||
RunID: "testRunID",
|
||||
OriginHost: "testOriginHost",
|
||||
Source: "testSource",
|
||||
OriginID: "testOriginId",
|
||||
TOR: "testTOR",
|
||||
RequestType: "testRequestType",
|
||||
Tenant: "cgrates.org",
|
||||
Category: "testCategory",
|
||||
Account: "testAccount",
|
||||
Subject: "testSubject",
|
||||
Destination: "testDestination",
|
||||
SetupTime: time.Date(2021, 3, 3, 3, 3, 3, 3, time.UTC),
|
||||
AnswerTime: utils.TimePointer(time.Date(2021, 3, 3, 3, 3, 3, 3, time.UTC)),
|
||||
Usage: 2,
|
||||
ExtraFields: "extraFields",
|
||||
CostSource: "testCostSource",
|
||||
Cost: 2,
|
||||
CostDetails: "testCostDetails",
|
||||
ExtraInfo: "testExtraInfo",
|
||||
CreatedAt: time.Date(2021, 3, 3, 3, 3, 3, 3, time.UTC),
|
||||
UpdatedAt: time.Date(2021, 3, 3, 3, 3, 3, 3, time.UTC),
|
||||
DeletedAt: utils.TimePointer(time.Date(2021, 3, 3, 3, 3, 3, 3, time.UTC)),
|
||||
}
|
||||
expected := map[string]interface{}{
|
||||
"cgrid": testCdrSql.Cgrid,
|
||||
"run_id": testCdrSql.RunID,
|
||||
"origin_host": testCdrSql.OriginHost,
|
||||
"source": testCdrSql.Source,
|
||||
"origin_id": testCdrSql.OriginID,
|
||||
"tor": testCdrSql.TOR,
|
||||
"request_type": testCdrSql.RequestType,
|
||||
"tenant": testCdrSql.Tenant,
|
||||
"category": testCdrSql.Category,
|
||||
"account": testCdrSql.Account,
|
||||
"subject": testCdrSql.Subject,
|
||||
"destination": testCdrSql.Destination,
|
||||
"setup_time": testCdrSql.SetupTime,
|
||||
"answer_time": testCdrSql.AnswerTime,
|
||||
"usage": testCdrSql.Usage,
|
||||
"extra_fields": testCdrSql.ExtraFields,
|
||||
"cost_source": testCdrSql.CostSource,
|
||||
"cost": testCdrSql.Cost,
|
||||
"cost_details": testCdrSql.CostDetails,
|
||||
"extra_info": testCdrSql.ExtraInfo,
|
||||
"created_at": testCdrSql.CreatedAt,
|
||||
"updated_at": testCdrSql.UpdatedAt,
|
||||
}
|
||||
result := testCdrSql.AsMapStringInterface()
|
||||
if !reflect.DeepEqual(expected, result) {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user