mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
100% coverage for stats.go and sessions.go in Dispatchers
This commit is contained in:
committed by
Dan Christian Bogos
parent
e55e50eceb
commit
edf33f4b67
@@ -28,6 +28,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -1053,3 +1054,698 @@ func testDspSessionSTIRIdentity(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1PingNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1Ping(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1PingErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1Ping(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1AuthorizeEventNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1AuthorizeArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1AuthorizeReply
|
||||
result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1AuthorizeEventErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1AuthorizeArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1AuthorizeReply
|
||||
result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1AuthorizeEventWithDigestNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1AuthorizeArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1AuthorizeReplyWithDigest
|
||||
result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1AuthorizeEventWithDigestErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1AuthorizeArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1AuthorizeReplyWithDigest
|
||||
result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1InitiateSessionNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1InitSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1InitSessionReply
|
||||
result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1InitiateSessionErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1InitSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1InitSessionReply
|
||||
result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1InitiateSessionWithDigestNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1InitSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1InitReplyWithDigest
|
||||
result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1InitiateSessionWithDigestErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1InitSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1InitReplyWithDigest
|
||||
result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1UpdateSessionNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1UpdateSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1UpdateSessionReply
|
||||
result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1UpdateSessionErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1UpdateSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1UpdateSessionReply
|
||||
result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1SyncSessionsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.TenantWithAPIOpts{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1SyncSessionsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.TenantWithAPIOpts{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1TerminateSessionNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1TerminateSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1TerminateSessionErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1TerminateSessionArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ProcessCDRNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ProcessCDRErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ProcessMessageNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1ProcessMessageArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1ProcessMessageReply
|
||||
result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ProcessMessageErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1ProcessMessageArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1ProcessMessageReply
|
||||
result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ProcessEventNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1ProcessEventArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1ProcessEventReply
|
||||
result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ProcessEventErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1ProcessEventArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1ProcessEventReply
|
||||
result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetCostNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1ProcessEventArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1GetCostReply
|
||||
result := dspSrv.SessionSv1GetCost(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetCostErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1ProcessEventArgs{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *sessions.V1GetCostReply
|
||||
result := dspSrv.SessionSv1GetCost(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetActiveSessionsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *[]*sessions.ExternalSession
|
||||
result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetActiveSessionsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *[]*sessions.ExternalSession
|
||||
result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetActiveSessionsCountNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *int
|
||||
result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetActiveSessionsCountErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *int
|
||||
result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ForceDisconnectNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ForceDisconnectErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetPassiveSessionsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *[]*sessions.ExternalSession
|
||||
result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetPassiveSessionsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *[]*sessions.ExternalSession
|
||||
result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ReplicateSessionsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := ArgsReplicateSessionsWithAPIOpts{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ReplicateSessionsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := ArgsReplicateSessionsWithAPIOpts{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetPassiveSessionsCountNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *int
|
||||
result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1GetPassiveSessionsCountErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionFilter{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *int
|
||||
result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1SetPassiveSessionNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.Session{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1SetPassiveSessionErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.Session{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ActivateSessionsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionIDsWithArgsDispatcher{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1ActivateSessionsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionIDsWithArgsDispatcher{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1DeactivateSessionsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.SessionIDsWithArgsDispatcher{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1DeactivateSessionsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.SessionIDsWithArgsDispatcher{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1STIRAuthenticateNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1STIRAuthenticateArgs{}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1STIRAuthenticateErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1STIRAuthenticateArgs{}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1STIRIdentityNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &sessions.V1STIRIdentityArgs{}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspSessionSv1STIRIdentityErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &sessions.V1STIRIdentityArgs{}
|
||||
var reply *string
|
||||
result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -360,3 +362,205 @@ func testDspStsTestAuthKey3(t *testing.T) {
|
||||
t.Errorf("expecting: %+v, received reply: %v", estats, reply)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1PingNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.StatSv1Ping(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1PingNilEvent(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
var reply *string
|
||||
result := dspSrv.StatSv1Ping(nil, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1PingErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *string
|
||||
result := dspSrv.StatSv1Ping(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetStatQueuesForEventNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &engine.StatsArgsProcessEvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *[]string
|
||||
result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetStatQueuesForEventErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &engine.StatsArgsProcessEvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *[]string
|
||||
result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetQueueStringMetricsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.TenantIDWithAPIOpts{
|
||||
TenantID: &utils.TenantID{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *map[string]string
|
||||
result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetQueueStringMetricsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.TenantIDWithAPIOpts{
|
||||
TenantID: &utils.TenantID{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *map[string]string
|
||||
result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1ProcessEventNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &engine.StatsArgsProcessEvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *[]string
|
||||
result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1ProcessEventErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &engine.StatsArgsProcessEvent{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *[]string
|
||||
result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetQueueFloatMetricsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.TenantIDWithAPIOpts{
|
||||
TenantID: &utils.TenantID{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *map[string]float64
|
||||
result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetQueueFloatMetricsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.TenantIDWithAPIOpts{
|
||||
TenantID: &utils.TenantID{
|
||||
Tenant: "tenant",
|
||||
},
|
||||
}
|
||||
var reply *map[string]float64
|
||||
result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
|
||||
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetQueueIDsNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
CGREvent := &utils.TenantWithAPIOpts{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *[]string
|
||||
result := dspSrv.StatSv1GetQueueIDs(CGREvent, reply)
|
||||
expected := "DISPATCHER_ERROR:NOT_FOUND"
|
||||
if result == nil || result.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspStatSv1GetQueueIDsErrorNil(t *testing.T) {
|
||||
cgrCfg := config.NewDefaultCGRConfig()
|
||||
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
||||
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
||||
CGREvent := &utils.TenantWithAPIOpts{
|
||||
Tenant: "tenant",
|
||||
}
|
||||
var reply *[]string
|
||||
result := dspSrv.StatSv1GetQueueIDs(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