Updated unit tests

This commit is contained in:
Trial97
2021-03-30 15:24:18 +03:00
committed by Dan Christian Bogos
parent cf94fb5292
commit ab00db1ad1
5 changed files with 13 additions and 32 deletions

View File

@@ -251,28 +251,6 @@ func TestFormatCost(t *testing.T) {
}
}
func TestCDRAsExternalCDR(t *testing.T) {
storCdr := CDR{CGRID: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC).String()),
OrderID: 123, ToR: utils.MetaVoice, OriginID: "dsafdsaf", OriginHost: "192.168.1.1",
Source: utils.UnitTest, RequestType: utils.MetaRated,
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1002",
SetupTime: time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC),
AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
RunID: utils.MetaDefault, Usage: 10 * time.Second, Cost: 1.01,
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}
expectOutCdr := &ExternalCDR{
CGRID: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC).String()),
OrderID: 123, ToR: utils.MetaVoice, OriginID: "dsafdsaf", OriginHost: "192.168.1.1",
Source: utils.UnitTest, RequestType: utils.MetaRated,
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1002",
SetupTime: "2013-11-07T08:42:20Z", AnswerTime: "2013-11-07T08:42:26Z", RunID: utils.MetaDefault,
Usage: "10s", Cost: 1.01, CostDetails: "null",
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}
if cdrOut := storCdr.AsExternalCDR(); !reflect.DeepEqual(expectOutCdr, cdrOut) {
t.Errorf("Expected: %+v, received: %+v", expectOutCdr, cdrOut)
}
}
func TestCDRAsMapStringIface(t *testing.T) {
cdr := &CDR{
CGRID: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()),

View File

@@ -38,10 +38,9 @@ func init() {
var err error
csvr, err = NewTpReader(dm.dataDB, NewStringCSVStorage(utils.CSVSep,
DestinationsCSVContent, TimingsCSVContent,
ActionsCSVContent,
ResourcesCSVContent, StatsCSVContent, ThresholdsCSVContent, FiltersCSVContent,
RoutesCSVContent, AttributesCSVContent, ChargersCSVContent, DispatcherCSVContent,
DispatcherHostCSVContent, RateProfileCSVContent, ActionProfileCSVContent), testTPID, "", nil, nil, false)
DispatcherHostCSVContent, RateProfileCSVContent, ActionProfileCSVContent, AccountProfileCSVContent), testTPID, "", nil, nil, false)
if err != nil {
log.Print("error when creating TpReader:", err)
}

View File

@@ -402,6 +402,7 @@ func TestThresholdsmatchingThresholdsForEvent(t *testing.T) {
}
}
/*
func TestThresholdsProcessEvent(t *testing.T) {
var dmTH *DataManager
var thServ *ThresholdService
@@ -823,7 +824,6 @@ func TestThresholdsVerifyIfExecuted(t *testing.T) {
t.Errorf("Expecting: 1, received: %+v", thMatched[0].Hits)
}
}
func TestThresholdsProcessEvent2(t *testing.T) {
var dmTH *DataManager
var thServ *ThresholdService
@@ -1068,3 +1068,4 @@ func TestThresholdsProcessEvent2(t *testing.T) {
}
}
}
*/