mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 20:59:53 +05:00
100% coverage for cdrs.go in Dispatchers
This commit is contained in:
committed by
Dan Christian Bogos
parent
1d70718d72
commit
ebcb501e28
@@ -874,3 +874,57 @@ func TestDspCDRsV2ProcessEventErrorNil(t *testing.T) {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspCDRsV1StoreSessionCostNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &engine.AttrCDRSStoreSMCost{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspCDRsV1StoreSessionCostErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &engine.AttrCDRSStoreSMCost{}
|
||||
var reply *string
|
||||
result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspCDRsV2StoreSessionCostNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &engine.ArgsV2CDRSStoreSMCost{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspCDRsV2StoreSessionCostErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &engine.ArgsV2CDRSStoreSMCost{}
|
||||
var reply *string
|
||||
result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user