mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 18:46:24 +05:00
2155 lines
73 KiB
Go
2155 lines
73 KiB
Go
/*
|
|
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
|
Copyright (C) ITsysCOM GmbH
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
*/
|
|
|
|
package dispatchers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/cgrates/cgrates/config"
|
|
"github.com/cgrates/cgrates/engine"
|
|
"github.com/cgrates/cgrates/utils"
|
|
)
|
|
|
|
func TestDspReplicatorSv1PingNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1Ping(nil, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1PingNil(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.ReplicatorSv1Ping(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1PingErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.CGREvent{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1Ping(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetStatQueueNil(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 *engine.StatQueue
|
|
result := dspSrv.ReplicatorSv1GetStatQueue(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetStatQueueErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.StatQueue
|
|
result := dspSrv.ReplicatorSv1GetStatQueue(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetFilterNil(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 *engine.Filter
|
|
result := dspSrv.ReplicatorSv1GetFilter(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetFilterErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.Filter
|
|
result := dspSrv.ReplicatorSv1GetFilter(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetThresholdNil(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 *engine.Threshold
|
|
result := dspSrv.ReplicatorSv1GetThreshold(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetThresholdErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.Threshold
|
|
result := dspSrv.ReplicatorSv1GetThreshold(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetThresholdProfileNil(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 *engine.ThresholdProfile
|
|
result := dspSrv.ReplicatorSv1GetThresholdProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetThresholdProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.ThresholdProfile
|
|
result := dspSrv.ReplicatorSv1GetThresholdProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetStatQueueProfileNil(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 *engine.StatQueueProfile
|
|
result := dspSrv.ReplicatorSv1GetStatQueueProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetStatQueueProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.StatQueueProfile
|
|
result := dspSrv.ReplicatorSv1GetStatQueueProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetResourceNil(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 *engine.Resource
|
|
result := dspSrv.ReplicatorSv1GetResource(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetResourceErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.Resource
|
|
result := dspSrv.ReplicatorSv1GetResource(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetResourceProfileReplicatorSv1GetResourceProfileNil(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 *engine.ResourceProfile
|
|
result := dspSrv.ReplicatorSv1GetResourceProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetResourceProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.ResourceProfile
|
|
result := dspSrv.ReplicatorSv1GetResourceProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetRouteProfileNil(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 *engine.RouteProfile
|
|
result := dspSrv.ReplicatorSv1GetRouteProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetRouteProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.RouteProfile
|
|
result := dspSrv.ReplicatorSv1GetRouteProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetAttributeProfileNil(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 *engine.AttributeProfile
|
|
result := dspSrv.ReplicatorSv1GetAttributeProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetAttributeProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.AttributeProfile
|
|
result := dspSrv.ReplicatorSv1GetAttributeProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetChargerProfileNil(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 *engine.ChargerProfile
|
|
result := dspSrv.ReplicatorSv1GetChargerProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetChargerProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.ChargerProfile
|
|
result := dspSrv.ReplicatorSv1GetChargerProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetDispatcherProfileNil(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 *engine.DispatcherProfile
|
|
result := dspSrv.ReplicatorSv1GetDispatcherProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetDispatcherProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.DispatcherProfile
|
|
result := dspSrv.ReplicatorSv1GetDispatcherProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetDispatcherHostNil(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 *engine.DispatcherHost
|
|
result := dspSrv.ReplicatorSv1GetDispatcherHost(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetDispatcherHostErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.DispatcherHost
|
|
result := dspSrv.ReplicatorSv1GetDispatcherHost(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetItemLoadIDsNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
var reply *map[string]int64
|
|
result := dspSrv.ReplicatorSv1GetItemLoadIDs(nil, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetItemLoadIDsNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.StringWithAPIOpts{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *map[string]int64
|
|
result := dspSrv.ReplicatorSv1GetItemLoadIDs(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetItemLoadIDsErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.StringWithAPIOpts{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *map[string]int64
|
|
result := dspSrv.ReplicatorSv1GetItemLoadIDs(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetThresholdProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.ThresholdProfileWithAPIOpts{
|
|
ThresholdProfile: &engine.ThresholdProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetThresholdProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetThresholdProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.ThresholdProfileWithAPIOpts{
|
|
ThresholdProfile: &engine.ThresholdProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetThresholdProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveFilterNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveFilter(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveFilterErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveFilter(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveFilterNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveFilter(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveThresholdProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveThresholdProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveThresholdProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveThresholdProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveThresholdProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveThresholdProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveStatQueueProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveStatQueueProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveStatQueueProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveResourceNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveResource(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveResourceErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveResource(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveResourceNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveResource(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveResourceProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveResourceProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveResourceProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveResourceProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveResourceProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveResourceProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveActionsNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.StringWithAPIOpts{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveActions(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveActionsErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.StringWithAPIOpts{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveActions(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveActionsEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveActions(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveRouteProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveRouteProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveRouteProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveRouteProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveRouteProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveRouteProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveAttributeProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveAttributeProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveAttributeProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveAttributeProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveAttributeProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveAttributeProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveChargerProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveChargerProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveChargerProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveChargerProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveChargerProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveChargerProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveDispatcherHostNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveDispatcherHost(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveDispatcherHostErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveDispatcherHost(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveDispatcherHostNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveDispatcherHost(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveDispatcherProfileNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveDispatcherProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveDispatcherProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetIndexesNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.GetIndexesArg{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *map[string]utils.StringSet
|
|
result := dspSrv.ReplicatorSv1GetIndexes(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetIndexesErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.GetIndexesArg{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *map[string]utils.StringSet
|
|
result := dspSrv.ReplicatorSv1GetIndexes(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetIndexesNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *map[string]utils.StringSet
|
|
result := dspSrv.ReplicatorSv1GetIndexes(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetIndexesNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.SetIndexesArg{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetIndexes(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetIndexesErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.SetIndexesArg{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetIndexes(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetIndexesNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetIndexes(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveIndexesNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.GetIndexesArg{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveIndexes(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetLoadIDsNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.LoadIDsWithAPIOpts{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetLoadIDs(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetLoadIDsErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.LoadIDsWithAPIOpts{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetLoadIDs(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetLoadIDsNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetLoadIDs(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveAccountNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveAccount(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveAccountErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveAccount(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveAccountNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveAccount(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveStatQueueNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveStatQueue(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveStatQueueErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveStatQueue(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveStatQueueNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveStatQueue(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveIndexesErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.GetIndexesArg{
|
|
Tenant: "tenant",
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveIndexes(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveIndexesNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveIndexes(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetThresholdProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetThresholdProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetThresholdNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.ThresholdWithAPIOpts{
|
|
Threshold: &engine.Threshold{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetThreshold(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetThresholdErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.ThresholdWithAPIOpts{
|
|
Threshold: &engine.Threshold{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetThreshold(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetThresholdNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetThreshold(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetAccountNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.AccountWithAPIOpts{
|
|
Account: &utils.Account{},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetAccount(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetAccountErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.AccountWithAPIOpts{
|
|
Account: &utils.Account{
|
|
ID: "testID",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetAccount(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetAccountNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetAccount(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetStatQueueNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.StatQueueWithAPIOpts{
|
|
StatQueue: &engine.StatQueue{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetStatQueue(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetStatQueueErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.StatQueueWithAPIOpts{
|
|
StatQueue: &engine.StatQueue{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetStatQueue(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetStatQueueNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetStatQueue(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetFilterNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.FilterWithAPIOpts{
|
|
Filter: &engine.Filter{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetFilter(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetFilterErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.FilterWithAPIOpts{
|
|
Filter: &engine.Filter{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetFilter(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetFilterNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetFilter(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetStatQueueProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.StatQueueProfileWithAPIOpts{
|
|
StatQueueProfile: &engine.StatQueueProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetStatQueueProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetStatQueueProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.StatQueueProfileWithAPIOpts{
|
|
StatQueueProfile: &engine.StatQueueProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetStatQueueProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetStatQueueProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetStatQueueProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetResourceNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.ResourceWithAPIOpts{
|
|
Resource: &engine.Resource{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetResource(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetResourceErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.ResourceWithAPIOpts{
|
|
Resource: &engine.Resource{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetResource(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetResourceNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetResource(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetResourceProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.ResourceProfileWithAPIOpts{
|
|
ResourceProfile: &engine.ResourceProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetResourceProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestReplicatorSv1SetResourceProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.ResourceProfileWithAPIOpts{
|
|
ResourceProfile: &engine.ResourceProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetResourceProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetResourceProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetResourceProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetRouteProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.RouteProfileWithAPIOpts{
|
|
RouteProfile: &engine.RouteProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetRouteProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetRouteProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.RouteProfileWithAPIOpts{
|
|
RouteProfile: &engine.RouteProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetRouteProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetRouteProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetRouteProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetAttributeProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.AttributeProfileWithAPIOpts{
|
|
AttributeProfile: &engine.AttributeProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetAttributeProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetAttributeProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.AttributeProfileWithAPIOpts{
|
|
AttributeProfile: &engine.AttributeProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetAttributeProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetAttributeProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetAttributeProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetChargerProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.ChargerProfileWithAPIOpts{
|
|
ChargerProfile: &engine.ChargerProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetChargerProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetChargerProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.ChargerProfileWithAPIOpts{
|
|
ChargerProfile: &engine.ChargerProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetChargerProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetChargerProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetChargerProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetDispatcherProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.DispatcherProfileWithAPIOpts{
|
|
DispatcherProfile: &engine.DispatcherProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetDispatcherProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetDispatcherProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.DispatcherProfileWithAPIOpts{
|
|
DispatcherProfile: &engine.DispatcherProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetDispatcherProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetDispatcherProfileNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetDispatcherProfile(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetDispatcherHostNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.DispatcherHostWithAPIOpts{
|
|
DispatcherHost: &engine.DispatcherHost{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetDispatcherHost(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestReplicatorSv1SetDispatcherHostErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.DispatcherHostWithAPIOpts{
|
|
DispatcherHost: &engine.DispatcherHost{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetDispatcherHost(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetDispatcherHostNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetDispatcherHost(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveThresholdNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveThreshold(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestReplicatorSv1RemoveThresholdErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveThreshold(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveThresholdNilEvent(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveThreshold(nil, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetRateProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *utils.RateProfile
|
|
result := dspSrv.ReplicatorSv1GetRateProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetRateProfileErrorTenant(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *utils.RateProfile
|
|
result := dspSrv.ReplicatorSv1GetRateProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetRateProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.TenantIDWithAPIOpts{}
|
|
var reply *utils.RateProfile
|
|
result := dspSrv.ReplicatorSv1GetRateProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetActionProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.ActionProfile
|
|
result := dspSrv.ReplicatorSv1GetActionProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetActionProfileErrorTenant(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *engine.ActionProfile
|
|
result := dspSrv.ReplicatorSv1GetActionProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetActionProfileErrorNil(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 *engine.ActionProfile
|
|
result := dspSrv.ReplicatorSv1GetActionProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetActionProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &engine.ActionProfileWithAPIOpts{
|
|
ActionProfile: &engine.ActionProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetActionProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetActionProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &engine.ActionProfileWithAPIOpts{
|
|
ActionProfile: &engine.ActionProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetActionProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetActionProfileErrorNilArgs(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetActionProfile(nil, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetRateProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.RateProfileWithAPIOpts{
|
|
RateProfile: &utils.RateProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetRateProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetRateProfileErrorNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
CGREvent := &utils.RateProfileWithAPIOpts{
|
|
RateProfile: &utils.RateProfile{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetRateProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1SetRateProfileErrorNilArgs(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1SetRateProfile(nil, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveRateProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveRateProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDsReplicatorSv1RemoveRateProfileErrorNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveRateProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveRateProfileErrorNilArgs(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveRateProfile(nil, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveActionProfileNil(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveActionProfile(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1RemoveActionProfileErrorNil(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 *string
|
|
result := dspSrv.ReplicatorSv1RemoveActionProfile(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestReplicatorSv1RemoveActionProfileNilArgs(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
|
|
var reply *string
|
|
result := dspSrv.ReplicatorSv1RemoveActionProfile(nil, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetAccountErrorNil(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 *utils.Account
|
|
result := dspSrv.ReplicatorSv1GetAccount(CGREvent, reply)
|
|
expected := "MANDATORY_IE_MISSING: [ApiKey]"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|
|
|
|
func TestDspReplicatorSv1GetAccountErrorCase2(t *testing.T) {
|
|
cgrCfg := config.NewDefaultCGRConfig()
|
|
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
|
|
CGREvent := &utils.TenantIDWithAPIOpts{
|
|
TenantID: &utils.TenantID{
|
|
Tenant: "tenant",
|
|
},
|
|
}
|
|
var reply *utils.Account
|
|
result := dspSrv.ReplicatorSv1GetAccount(CGREvent, reply)
|
|
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
|
|
if result == nil || result.Error() != expected {
|
|
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
|
}
|
|
}
|