mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Fixed tests in dispatchers
This commit is contained in:
committed by
Dan Christian Bogos
parent
ff73fdac5f
commit
40cc2c73f7
@@ -80,10 +80,10 @@ func testDspChcPing(t *testing.T) {
|
||||
if dispEngine.RPC == nil {
|
||||
t.Fatal(dispEngine.RPC)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.CacheSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.CacheSv1Ping, &utils.CGREvent{
|
||||
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "chc12345",
|
||||
},
|
||||
|
||||
@@ -103,10 +103,8 @@ func testDspCDRsPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.CDRsV1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.CDRsV1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "cdrs12345",
|
||||
},
|
||||
@@ -120,23 +118,22 @@ func testDspCDRsPing(t *testing.T) {
|
||||
func testDspCDRsProcessEvent(t *testing.T) {
|
||||
var reply string
|
||||
args := &engine.ArgV1ProcessEvent{
|
||||
CGREventWithOpts: utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsProcessEvent",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsProcessEvent",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
"field_extr1": "val_extr1",
|
||||
"fieldextr2": "valextr2",
|
||||
},
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsProcessEvent",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsProcessEvent",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
"field_extr1": "val_extr1",
|
||||
"fieldextr2": "valextr2",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "cdrs12345",
|
||||
},
|
||||
@@ -319,20 +316,18 @@ func testDspCDRsV2ProcessEvent(t *testing.T) {
|
||||
var reply []*utils.EventWithFlags
|
||||
args := &engine.ArgV1ProcessEvent{
|
||||
Flags: []string{utils.MetaRALs},
|
||||
CGREventWithOpts: utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsV2ProcessEvent",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsV2ProcessEvent",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
},
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsV2ProcessEvent",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsV2ProcessEvent",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "cdrsv212345",
|
||||
@@ -397,10 +392,8 @@ func testDspCDRsPingNoAuth(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.CDRsV1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.CDRsV1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.Pong {
|
||||
@@ -411,22 +404,20 @@ func testDspCDRsPingNoAuth(t *testing.T) {
|
||||
func testDspCDRsProcessEventNoAuth(t *testing.T) {
|
||||
var reply string
|
||||
args := &engine.ArgV1ProcessEvent{
|
||||
CGREventWithOpts: utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsProcessEvent",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsProcessEvent",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
"field_extr1": "val_extr1",
|
||||
"fieldextr2": "valextr2",
|
||||
},
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsProcessEvent",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsProcessEvent",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
"field_extr1": "val_extr1",
|
||||
"fieldextr2": "valextr2",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -586,20 +577,18 @@ func testDspCDRsV2ProcessEventNoAuth(t *testing.T) {
|
||||
var reply []*utils.EventWithFlags
|
||||
args := &engine.ArgV1ProcessEvent{
|
||||
Flags: []string{utils.MetaRALs},
|
||||
CGREventWithOpts: utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsV2ProcessEventNoAuth",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsV2ProcessEventNoAuth",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
},
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.OriginID: "testDspCDRsV2ProcessEventNoAuth",
|
||||
utils.OriginHost: "192.168.1.1",
|
||||
utils.Source: "testDspCDRsV2ProcessEventNoAuth",
|
||||
utils.RequestType: utils.MetaRated,
|
||||
utils.AccountField: "1001",
|
||||
utils.Subject: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC),
|
||||
utils.Usage: time.Minute,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -74,10 +74,9 @@ func testDspCppPingFailover(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "chrg12345",
|
||||
},
|
||||
@@ -102,15 +101,14 @@ func testDspCppPingFailover(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspCppGetChtgFailover(t *testing.T) {
|
||||
args := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
args := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "chrg12345",
|
||||
},
|
||||
@@ -171,10 +169,8 @@ func testDspCppPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.ChargerSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.ChargerSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "chrg12345",
|
||||
},
|
||||
@@ -186,13 +182,11 @@ func testDspCppPing(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspCppTestAuthKey(t *testing.T) {
|
||||
args := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
args := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "12345",
|
||||
@@ -206,14 +200,13 @@ func testDspCppTestAuthKey(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspCppTestAuthKey2(t *testing.T) {
|
||||
args := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
args := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "chrg12345",
|
||||
},
|
||||
@@ -254,14 +247,12 @@ func testDspCppTestAuthKey2(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspCppGetChtgRoundRobin(t *testing.T) {
|
||||
args := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "RoundRobin",
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
args := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "RoundRobin",
|
||||
utils.AccountField: "1001",
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "chrg12345",
|
||||
|
||||
@@ -67,10 +67,9 @@ func testDspGrdPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.GuardianSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.GuardianSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "grd12345",
|
||||
},
|
||||
|
||||
@@ -66,10 +66,9 @@ func testDspRALsPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.RALsV1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.RALsV1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rals12345",
|
||||
},
|
||||
|
||||
@@ -70,10 +70,8 @@ func testDspRPrfPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.RateSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.RateSv1Ping, utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rPrf12345",
|
||||
},
|
||||
@@ -141,14 +139,13 @@ func testDspRPrfCostForEvent(t *testing.T) {
|
||||
|
||||
var rpCost *engine.RateProfileCost
|
||||
if err := dispEngine.RPC.Call(utils.RateSv1CostForEvent, &utils.ArgsCostForEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DefaultRate",
|
||||
Event: map[string]interface{}{
|
||||
utils.Subject: "1001",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DefaultRate",
|
||||
Event: map[string]interface{}{
|
||||
utils.Subject: "1001",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rPrf12345",
|
||||
}}}, &rpCost); err != nil {
|
||||
@@ -214,14 +211,14 @@ func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
|
||||
|
||||
var rpCost *engine.RateProfileCost
|
||||
if err := dispEngine.RPC.Call(utils.RateSv1CostForEvent, &utils.ArgsCostForEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "EVENT_RATE",
|
||||
Event: map[string]interface{}{
|
||||
utils.Subject: "1002",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
|
||||
Tenant: "cgrates.org",
|
||||
ID: "EVENT_RATE",
|
||||
Event: map[string]interface{}{
|
||||
utils.Subject: "1002",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rPrf12345",
|
||||
}}}, &rpCost); err != nil {
|
||||
|
||||
@@ -98,10 +98,9 @@ func testDspRplPingFailover(t *testing.T) {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
reply = utils.EmptyString
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "repl12345",
|
||||
},
|
||||
|
||||
@@ -71,10 +71,9 @@ func testDspResPingFailover(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -105,10 +104,8 @@ func testDspResPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.ResourceSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.ResourceSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -122,15 +119,14 @@ func testDspResPing(t *testing.T) {
|
||||
func testDspResTestAuthKey(t *testing.T) {
|
||||
var rs *engine.Resources
|
||||
args := &utils.ArgRSv1ResourceUsage{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "12345",
|
||||
},
|
||||
@@ -147,15 +143,14 @@ func testDspResTestAuthKey(t *testing.T) {
|
||||
func testDspResTestAuthKey2(t *testing.T) {
|
||||
var rs *engine.Resources
|
||||
args := &utils.ArgRSv1ResourceUsage{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -183,15 +178,13 @@ func testDspResTestAuthKey3(t *testing.T) {
|
||||
var reply string
|
||||
argsRU := utils.ArgRSv1ResourceUsage{
|
||||
UsageID: "651a8db2-4f67-4cf8-b622-169e8a482e51",
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -214,15 +207,13 @@ func testDspResTestAuthKey3(t *testing.T) {
|
||||
}
|
||||
argsRU = utils.ArgRSv1ResourceUsage{
|
||||
UsageID: "651a8db2-4f67-4cf8-b622-169e8a482e61",
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -237,15 +228,13 @@ func testDspResTestAuthKey3(t *testing.T) {
|
||||
// relase the only resource active for Resource1
|
||||
argsRU = utils.ArgRSv1ResourceUsage{
|
||||
UsageID: "651a8db2-4f67-4cf8-b622-169e8a482e55",
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -259,15 +248,13 @@ func testDspResTestAuthKey3(t *testing.T) {
|
||||
// only match Resource1 since we don't want for storing of the resource2 bellow
|
||||
argsRU = utils.ArgRSv1ResourceUsage{
|
||||
UsageID: "651a8db2-4f67-4cf8-b622-169e8a482e61",
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
@@ -281,15 +268,13 @@ func testDspResTestAuthKey3(t *testing.T) {
|
||||
}
|
||||
var rs *engine.Resources
|
||||
args := &utils.ArgRSv1ResourceUsage{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Event5",
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Event5",
|
||||
Event: map[string]interface{}{
|
||||
"Account": "1002",
|
||||
"Subject": "1001",
|
||||
"Destination": "1002"},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "res12345",
|
||||
},
|
||||
|
||||
@@ -94,13 +94,12 @@ func testDspResponderStatus(t *testing.T) {
|
||||
func getNodeWithRoute(route string, t *testing.T) string {
|
||||
var reply map[string]interface{}
|
||||
var pingReply string
|
||||
pingEv := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Random",
|
||||
},
|
||||
pingEv := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Random",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rsp12345",
|
||||
utils.OptsRouteID: route,
|
||||
@@ -168,13 +167,12 @@ func testDspResponderShutdown(t *testing.T) {
|
||||
|
||||
func testDspResponderBroadcast(t *testing.T) {
|
||||
var pingReply string
|
||||
pingEv := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Broadcast",
|
||||
},
|
||||
pingEv := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Broadcast",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rsp12345",
|
||||
},
|
||||
@@ -205,13 +203,12 @@ func testDspResponderInternal(t *testing.T) {
|
||||
var reply map[string]interface{}
|
||||
var pingReply string
|
||||
route := "internal"
|
||||
pingEv := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Internal",
|
||||
},
|
||||
pingEv := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Internal",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "rsp12345",
|
||||
utils.OptsRouteID: route,
|
||||
|
||||
@@ -78,10 +78,8 @@ func testDspSupPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.RouteSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.RouteSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sup12345",
|
||||
},
|
||||
@@ -99,10 +97,9 @@ func testDspSupPingFailover(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sup12345",
|
||||
},
|
||||
@@ -168,20 +165,19 @@ func testDspSupGetSupFailover(t *testing.T) {
|
||||
},
|
||||
}
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sup12345",
|
||||
},
|
||||
@@ -206,18 +202,17 @@ func testDspSupGetSupFailover(t *testing.T) {
|
||||
func testDspSupTestAuthKey(t *testing.T) {
|
||||
var rpl *engine.SortedRoutes
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "12345",
|
||||
},
|
||||
@@ -257,19 +252,18 @@ func testDspSupTestAuthKey2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sup12345",
|
||||
},
|
||||
@@ -325,20 +319,19 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
|
||||
},
|
||||
}
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "RoundRobin",
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "RoundRobin",
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sup12345",
|
||||
},
|
||||
@@ -359,18 +352,17 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspSupGetSupplierForEvent(t *testing.T) {
|
||||
ev := &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testV1SplSGetHighestCostSuppliers",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
ev := &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testV1SplSGetHighestCostSuppliers",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.Subject: "1002",
|
||||
utils.Destination: "1001",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sup12345",
|
||||
},
|
||||
|
||||
@@ -65,10 +65,9 @@ func testDspSchedPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.SchedulerSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.SchedulerSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "sched12345",
|
||||
},
|
||||
|
||||
@@ -138,10 +138,9 @@ func testDspSessionPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.SessionSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.SessionSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -159,10 +158,9 @@ func testDspSessionPingFailover(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -193,22 +191,21 @@ func testDspSessionTestAuthKey(t *testing.T) {
|
||||
AuthorizeResources: true,
|
||||
GetRoutes: true,
|
||||
GetAttributes: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItAuth",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.Usage: authUsage,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItAuth",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.Usage: authUsage,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "12345",
|
||||
},
|
||||
@@ -228,23 +225,22 @@ func testDspSessionAuthorize(t *testing.T) {
|
||||
AuthorizeResources: true,
|
||||
GetRoutes: true,
|
||||
GetAttributes: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItAuth",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.Usage: authUsage,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItAuth",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.Usage: authUsage,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -281,24 +277,23 @@ func testDspSessionInit(t *testing.T) {
|
||||
InitSession: true,
|
||||
AllocateResources: true,
|
||||
GetAttributes: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItInitiateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: initUsage,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItInitiateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: initUsage,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -358,24 +353,23 @@ func testDspSessionUpdate(t *testing.T) {
|
||||
argsUpdate := &sessions.V1UpdateSessionArgs{
|
||||
GetAttributes: true,
|
||||
UpdateSession: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: reqUsage,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: reqUsage,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -389,29 +383,27 @@ func testDspSessionUpdate(t *testing.T) {
|
||||
eAttrs := &engine.AttrSProcessEventReply{
|
||||
MatchedProfiles: []string{"ATTR_ACNT_1001"},
|
||||
AlteredFields: []string{"*req.OfficeGroup"},
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"OfficeGroup": "Marketing",
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: float64(reqUsage),
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
utils.Subsys: utils.MetaSessionS,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"OfficeGroup": "Marketing",
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: float64(reqUsage),
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB { // gob maintains the variable type
|
||||
@@ -433,23 +425,21 @@ func testDspSessionUpdate2(t *testing.T) {
|
||||
argsUpdate := &sessions.V1UpdateSessionArgs{
|
||||
GetAttributes: true,
|
||||
UpdateSession: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: reqUsage,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: reqUsage,
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
@@ -464,31 +454,30 @@ func testDspSessionUpdate2(t *testing.T) {
|
||||
eAttrs := &engine.AttrSProcessEventReply{
|
||||
MatchedProfiles: []string{"ATTR_1001_SESSIONAUTH"},
|
||||
AlteredFields: []string{"*req.LCRProfile", "*req.Password", "*req.RequestType", "*req.PaypalAccount"},
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"LCRProfile": "premium_cli",
|
||||
"Password": "CGRateS.org",
|
||||
"PaypalAccount": "cgrates@paypal.com",
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: float64(reqUsage),
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
utils.Subsys: utils.MetaSessionS,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"LCRProfile": "premium_cli",
|
||||
"Password": "CGRateS.org",
|
||||
"PaypalAccount": "cgrates@paypal.com",
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: float64(reqUsage),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
sort.Strings(eAttrs.AlteredFields)
|
||||
@@ -513,24 +502,24 @@ func testDspSessionTerminate(t *testing.T) {
|
||||
args := &sessions.V1TerminateSessionArgs{
|
||||
TerminateSession: true,
|
||||
ReleaseResources: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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,
|
||||
},
|
||||
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItUpdateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -547,22 +536,20 @@ func testDspSessionTerminate(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspSessionProcessCDR(t *testing.T) {
|
||||
args := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessCDR",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPostpaid,
|
||||
utils.AccountField: "1001",
|
||||
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,
|
||||
},
|
||||
args := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessCDR",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It1",
|
||||
utils.RequestType: utils.MetaPostpaid,
|
||||
utils.AccountField: "1001",
|
||||
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,
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
@@ -585,25 +572,24 @@ func testDspSessionProcessEvent(t *testing.T) {
|
||||
AllocateResources: true,
|
||||
Debit: true,
|
||||
GetAttributes: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebac",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginHost: "disp",
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: initUsage,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebac",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginHost: "disp",
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: initUsage,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
@@ -623,30 +609,29 @@ func testDspSessionProcessEvent(t *testing.T) {
|
||||
eAttrs := &engine.AttrSProcessEventReply{
|
||||
MatchedProfiles: []string{"ATTR_ACNT_1001"},
|
||||
AlteredFields: []string{"*req.OfficeGroup"},
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebac",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"OfficeGroup": "Marketing",
|
||||
utils.OriginHost: "disp",
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: 300000000000.0,
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
utils.Subsys: utils.MetaSessionS,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebac",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"OfficeGroup": "Marketing",
|
||||
utils.OriginHost: "disp",
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: 300000000000.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB { // gob maintains the variable type
|
||||
@@ -666,25 +651,24 @@ func testDspSessionProcessEvent2(t *testing.T) {
|
||||
AllocateResources: true,
|
||||
Debit: true,
|
||||
GetAttributes: true,
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: initUsage,
|
||||
utils.EventName: "Internal",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "1001",
|
||||
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: initUsage,
|
||||
utils.EventName: "Internal",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "pse12345",
|
||||
},
|
||||
@@ -704,29 +688,28 @@ func testDspSessionProcessEvent2(t *testing.T) {
|
||||
eAttrs := &engine.AttrSProcessEventReply{
|
||||
MatchedProfiles: []string{"ATTR_1001_SIMPLEAUTH"},
|
||||
AlteredFields: []string{"*req.EventName", "*req.Password"},
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"Password": "CGRateS.org",
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: 300000000000.0,
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "pse12345",
|
||||
utils.Subsys: utils.MetaSessionS,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "TestSSv1ItProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.Category: "call",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.AccountField: "1001",
|
||||
utils.Destination: "1002",
|
||||
"Password": "CGRateS.org",
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.SetupTime: "2018-01-07T17:00:00Z",
|
||||
utils.AnswerTime: "2018-01-07T17:00:10Z",
|
||||
utils.Usage: 300000000000.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB { // gob maintains the variable type
|
||||
@@ -943,23 +926,22 @@ func testDspSessionForceDisconect(t *testing.T) {
|
||||
func testDspSessionProcessEvent3(t *testing.T) {
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
Flags: []string{"*rals:*terminate", "*resources:*release"},
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessEventTerminateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "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,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessEventTerminateSession",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.MetaVoice,
|
||||
utils.OriginID: "TestSSv1It2",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
utils.AccountField: "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,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "pse12345",
|
||||
},
|
||||
@@ -989,22 +971,21 @@ func testDspSessionProcessEvent3(t *testing.T) {
|
||||
func testDspSessionGetCost(t *testing.T) {
|
||||
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItGetCost",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.MetaMonetary,
|
||||
utils.OriginID: "testSSv1ItProcessEventWithGetCost",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
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,
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItGetCost",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.MetaMonetary,
|
||||
utils.OriginID: "testSSv1ItProcessEventWithGetCost",
|
||||
utils.RequestType: utils.MetaPrepaid,
|
||||
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,
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
},
|
||||
|
||||
@@ -74,10 +74,8 @@ func testDspStsPingFailover(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "stat12345",
|
||||
},
|
||||
@@ -106,19 +104,19 @@ func testDspStsGetStatFailover(t *testing.T) {
|
||||
var metrics map[string]string
|
||||
expected := []string{"Stats1"}
|
||||
args := engine.StatsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1001",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 135 * time.Second,
|
||||
utils.Cost: 123.0,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Destination: "1002"},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1001",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 135 * time.Second,
|
||||
utils.Cost: 123.0,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Destination: "1002",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "stat12345",
|
||||
},
|
||||
@@ -162,10 +160,8 @@ func testDspStsPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.StatSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.StatSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "stat12345",
|
||||
},
|
||||
@@ -179,17 +175,15 @@ func testDspStsPing(t *testing.T) {
|
||||
func testDspStsTestAuthKey(t *testing.T) {
|
||||
var reply []string
|
||||
args := engine.StatsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 135 * time.Second,
|
||||
utils.Cost: 123.0,
|
||||
utils.PDD: 12 * time.Second},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 135 * time.Second,
|
||||
utils.Cost: 123.0,
|
||||
utils.PDD: 12 * time.Second},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "12345",
|
||||
},
|
||||
@@ -222,18 +216,16 @@ func testDspStsTestAuthKey2(t *testing.T) {
|
||||
var metrics map[string]string
|
||||
expected := []string{"Stats2"}
|
||||
args := engine.StatsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 135 * time.Second,
|
||||
utils.Cost: 123.0,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Destination: "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1001",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 135 * time.Second,
|
||||
utils.Cost: 123.0,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Destination: "1002"},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "stat12345",
|
||||
},
|
||||
@@ -267,18 +259,16 @@ func testDspStsTestAuthKey2(t *testing.T) {
|
||||
}
|
||||
|
||||
args = engine.StatsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 45 * time.Second,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Cost: 10.0,
|
||||
utils.Destination: "1001",
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "event1",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 45 * time.Second,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Cost: 10.0,
|
||||
utils.Destination: "1001",
|
||||
},
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "stat12345",
|
||||
@@ -347,19 +337,19 @@ func testDspStsTestAuthKey3(t *testing.T) {
|
||||
estats = []string{"Stats2"}
|
||||
if err := dispEngine.RPC.Call(utils.StatSv1GetStatQueuesForEvent,
|
||||
&engine.StatsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "GetStats",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 45 * time.Second,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Cost: 10.0,
|
||||
utils.Destination: "1001",
|
||||
},
|
||||
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "GetStats",
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002",
|
||||
utils.AnswerTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: 45 * time.Second,
|
||||
utils.RunID: utils.MetaDefault,
|
||||
utils.Cost: 10.0,
|
||||
utils.Destination: "1001",
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "stat12345",
|
||||
},
|
||||
|
||||
@@ -74,10 +74,9 @@ func testDspThPingFailover(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
ev := utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ev := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "thr12345",
|
||||
},
|
||||
@@ -106,15 +105,14 @@ func testDspThProcessEventFailover(t *testing.T) {
|
||||
eIDs := []string{"THD_ACNT_1001"}
|
||||
nowTime := time.Now()
|
||||
args := &engine.ThresholdsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1001"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.EventName: "Event1",
|
||||
utils.AccountField: "1001"},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "thr12345",
|
||||
},
|
||||
@@ -141,10 +139,9 @@ func testDspThPing(t *testing.T) {
|
||||
} else if reply != utils.Pong {
|
||||
t.Errorf("Received: %s", reply)
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.ThresholdSv1Ping, &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
if err := dispEngine.RPC.Call(utils.ThresholdSv1Ping, &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "thr12345",
|
||||
},
|
||||
@@ -159,14 +156,13 @@ func testDspThTestAuthKey(t *testing.T) {
|
||||
var ids []string
|
||||
nowTime := time.Now()
|
||||
args := &engine.ThresholdsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002"},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "12345",
|
||||
},
|
||||
@@ -189,14 +185,13 @@ func testDspThTestAuthKey2(t *testing.T) {
|
||||
eIDs := []string{"THD_ACNT_1002"}
|
||||
nowTime := time.Now()
|
||||
args := &engine.ThresholdsArgsProcessEvent{
|
||||
CGREventWithOpts: &utils.CGREventWithOpts{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002"},
|
||||
},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
Time: &nowTime,
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "1002"},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "thr12345",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user