Fix tests for aliased CDRs in kamailio tutorial

This commit is contained in:
DanB
2015-09-19 21:23:00 +02:00
parent 50197116df
commit 2a51356e5b

View File

@@ -411,7 +411,7 @@ func TestTutKamCalls1002Cdrs(t *testing.T) {
req := utils.RpcCdrsFilter{Accounts: []string{"1002"}, RunIds: []string{utils.META_DEFAULT}}
if err := tutKamCallsRpc.Call("ApierV2.GetCdrs", req, &reply); err != nil {
t.Error("Unexpected error: ", err.Error())
} else if len(reply) != 1 {
} else if len(reply) != 2 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "KAMAILIO_CGR_CALL_END" {
@@ -494,24 +494,8 @@ func TestTutKamCalls1006Cdrs(t *testing.T) {
req := utils.RpcCdrsFilter{Accounts: []string{"1006"}, RunIds: []string{utils.META_DEFAULT}}
if err := tutKamCallsRpc.Call("ApierV2.GetCdrs", req, &reply); err != nil {
t.Error("Unexpected error: ", err.Error())
} else if len(reply) != 1 {
} else if len(reply) != 0 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "KAMAILIO_CGR_CALL_END" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_PREPAID {
t.Errorf("Unexpected ReqType for CDR: %+v", reply[0])
}
if reply[0].Destination != "1002" {
t.Errorf("Unexpected Destination for CDR: %+v", reply[0])
}
if reply[0].Usage != "64" && reply[0].Usage != "65" { // Usage as seconds
t.Errorf("Unexpected Usage for CDR: %+v", reply[0])
}
if reply[0].Cost == -1.0 { // Cost was not calculated
t.Errorf("Unexpected Cost for CDR: %+v", reply[0])
}
}
}