mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Added SessionSv1.ProcessEvent tests in DispatcherS
This commit is contained in:
committed by
Dan Christian Bogos
parent
b92280e38e
commit
dfd034433d
@@ -9,7 +9,7 @@ cgrates.org,ATTR_API_THR_AUTH,*auth,*string:~APIKey:thr12345,,,APIMethods,*const
|
||||
cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~APIKey:sup12345,,,APIMethods,*constant,SupplierSv1.Ping&SupplierSv1.GetSuppliers&SupplierSv1.GetSupplierProfilesForEvent,false,20
|
||||
cgrates.org,ATTR_API_STAT_AUTH,*auth,*string:~APIKey:stat12345,,,APIMethods,*constant,StatSv1.Ping&StatSv1.GetStatQueuesForEvent&StatSv1.GetQueueStringMetrics&StatSv1.ProcessEvent&StatSv1.GetQueueIDs&StatSv1.GetQueueFloatMetrics,false,20
|
||||
cgrates.org,ATTR_API_RES_AUTH,*auth,*string:~APIKey:res12345,,,APIMethods,*constant,ResourceSv1.Ping&ResourceSv1.GetResourcesForEvent&ResourceSv1.AuthorizeResources&ResourceSv1.AllocateResources&ResourceSv1.ReleaseResources,false,20
|
||||
cgrates.org,ATTR_API_SES_AUTH,*auth,*string:~APIKey:ses12345,,,APIMethods,*constant,SessionSv1.Ping&SessionSv1.AuthorizeEvent&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSession&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.SyncSessions&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessMessage&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.ReplicateSessions&SessionSv1.SetPassiveSession,false,20
|
||||
cgrates.org,ATTR_API_SES_AUTH,*auth,*string:~APIKey:ses12345,,,APIMethods,*constant,SessionSv1.Ping&SessionSv1.AuthorizeEvent&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSession&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.SyncSessions&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessMessage&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.ReplicateSessions&SessionSv1.SetPassiveSession&SessionSv1.ProcessEvent,false,20
|
||||
cgrates.org,ATTR_API_RSP_AUTH,*auth,*string:~APIKey:rsp12345,,,APIMethods,*constant,CoreSv1.Status&CoreSv1.Ping&Responder.GetTimeout&Responder.Shutdown&Responder.Ping,false,20
|
||||
cgrates.org,ATTR_API_CHC_AUTH,*auth,*string:~APIKey:chc12345,,,APIMethods,*constant,CacheSv1.Ping&CacheSv1.GetCacheStats&CacheSv1.LoadCache&CacheSv1.PrecacheStatus&CacheSv1.GetItemIDs&CacheSv1.HasItem&CacheSv1.GetItemExpiryTime&CacheSv1.ReloadCache&CacheSv1.RemoveItem&CacheSv1.FlushCache&CacheSv1.Clear,false,20
|
||||
cgrates.org,ATTR_API_GRD_AUTH,*auth,*string:~APIKey:grd12345,,,APIMethods,*constant,GuardianSv1.Ping&GuardianSv1.RemoteLock&GuardianSv1.RemoteUnlock,false,20
|
||||
|
||||
|
@@ -50,6 +50,8 @@ var sTestsDspSession = []func(t *testing.T){
|
||||
testDspSessionProcessEvent,
|
||||
testDspSessionProcessEvent2,
|
||||
|
||||
testDspSessionProcessEvent3,
|
||||
|
||||
testDspSessionReplicate,
|
||||
testDspSessionPassive,
|
||||
testDspSessionForceDisconect,
|
||||
@@ -847,3 +849,47 @@ func testDspSessionForceDisconect(t *testing.T) {
|
||||
t.Errorf("Expected no active sessions recived %v", repl)
|
||||
}
|
||||
}
|
||||
|
||||
func testDspSessionProcessEvent3(t *testing.T) {
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
Flags: []string{utils.MetaTerminate, "*resources:*release"},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessEventTerminateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.VOICE,
|
||||
utils.OriginID: "testSSv1ItProcessEvent",
|
||||
utils.RequestType: utils.META_PREPAID,
|
||||
utils.Account: "1001",
|
||||
utils.Subject: "ANY2CNT",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.AnswerTime: time.Date(2018, time.January, 7, 16, 60, 10, 0, time.UTC),
|
||||
utils.Usage: 10 * time.Minute,
|
||||
},
|
||||
},
|
||||
ArgDispatcher: &utils.ArgDispatcher{
|
||||
APIKey: utils.StringPointer("ses12345"),
|
||||
},
|
||||
}
|
||||
var rply sessions.V1ProcessEventReply
|
||||
if err := dispEngine.RCP.Call(utils.SessionSv1ProcessEvent,
|
||||
args, &rply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var repl int
|
||||
if err := dispEngine.RCP.Call(utils.SessionSv1GetActiveSessionsCount,
|
||||
utils.SessionFilter{
|
||||
ArgDispatcher: &utils.ArgDispatcher{
|
||||
APIKey: utils.StringPointer("ses12345"),
|
||||
},
|
||||
Tenant: "cgrates.org",
|
||||
Filters: []string{},
|
||||
}, &repl); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if repl != 0 {
|
||||
t.Errorf("Expected no active sessions recived %v", repl)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user