Update integration test for moving context out of cgrEvent

This commit is contained in:
TeoV
2019-02-18 11:04:56 +02:00
parent 51c10841de
commit 79e957c334
6 changed files with 217 additions and 191 deletions

View File

@@ -145,15 +145,18 @@ func testAttributeSLoadFromFolder(t *testing.T) {
}
func testAttributeSGetAttributeForEvent(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1007",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1007",
utils.Destination: "+491511231234",
},
},
}
eAttrPrf := &engine.AttributeProfile{
Tenant: ev.Tenant,
ID: "ATTR_1",
@@ -197,13 +200,15 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
}
func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaCDRs),
Event: map[string]interface{}{
utils.Account: "dan",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]interface{}{
utils.Account: "dan",
utils.Destination: "+491511231234",
},
},
}
eAttrPrf2 := &engine.AttributeProfile{
@@ -247,13 +252,15 @@ func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
}
func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaCDRs),
Event: map[string]interface{}{
utils.Account: "dan",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]interface{}{
utils.Account: "dan",
utils.Destination: "+491511231234",
},
},
}
eAttrPrf2 := &engine.AttributeProfile{
@@ -301,22 +308,23 @@ func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
}
func testAttributeSProcessEvent(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1007",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "1007",
utils.Destination: "+491511231234",
},
},
}
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_1"},
AlteredFields: []string{utils.Subject, utils.Account},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Subject: "1001",
@@ -328,9 +336,8 @@ func testAttributeSProcessEvent(t *testing.T) {
MatchedProfiles: []string{"ATTR_1"},
AlteredFields: []string{utils.Account, utils.Subject},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Subject: "1001",
@@ -350,16 +357,19 @@ func testAttributeSProcessEvent(t *testing.T) {
}
func testAttributeSProcessEventMissing(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "NonExist",
utils.Category: "*attributes",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "NonExist",
utils.Category: "*attributes",
utils.Destination: "+491511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
if err := attrSRPC.Call(utils.AttributeSv1ProcessEvent,
ev, &rplyEv); err == nil && err != utils.ErrMandatoryIeMissing {
@@ -368,13 +378,15 @@ func testAttributeSProcessEventMissing(t *testing.T) {
}
func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1008",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1008",
utils.Destination: "+491511231234",
},
},
}
alsPrf = &engine.AttributeProfile{
@@ -413,9 +425,8 @@ func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
MatchedProfiles: []string{"AttributeWithNonSubstitute"},
AlteredFields: []string{utils.Account},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Destination: "+491511231234",
@@ -434,14 +445,16 @@ func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
}
func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1008",
utils.Subject: "1008",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1008",
utils.Subject: "1008",
utils.Destination: "+491511231234",
},
},
}
alsPrf = &engine.AttributeProfile{
@@ -479,9 +492,8 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
MatchedProfiles: []string{"AttributeWithNonSubstitute"},
AlteredFields: []string{"Account", "Subject"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Destination: "+491511231234",
@@ -492,9 +504,8 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
MatchedProfiles: []string{"AttributeWithNonSubstitute"},
AlteredFields: []string{utils.Subject, utils.Account},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Destination: "+491511231234",
@@ -513,14 +524,16 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
}
func testAttributeSProcessEventWithNoneSubstitute3(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1008",
utils.Subject: "1001",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1008",
utils.Subject: "1001",
utils.Destination: "+491511231234",
},
},
}
alsPrf = &engine.AttributeProfile{
@@ -558,9 +571,8 @@ func testAttributeSProcessEventWithNoneSubstitute3(t *testing.T) {
MatchedProfiles: []string{"AttributeWithNonSubstitute"},
AlteredFields: []string{"Account"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Subject: "1001",
@@ -606,10 +618,10 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
}
attrArgs := &engine.AttrArgsProcessEvent{
ProcessRuns: utils.IntPointer(1),
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]interface{}{
"Field1": "Value1",
},
@@ -619,9 +631,8 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
MatchedProfiles: []string{"ATTR_Header"},
AlteredFields: []string{"Field2"},
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]interface{}{
"Field1": "Value1",
"Field2": "Value1",
@@ -882,10 +893,10 @@ func testAttributeSProcessEventWithSearchAndReplace(t *testing.T) {
}
attrArgs := &engine.AttrArgsProcessEvent{
ProcessRuns: utils.IntPointer(1),
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]interface{}{
"Category": "call",
},
@@ -895,9 +906,8 @@ func testAttributeSProcessEventWithSearchAndReplace(t *testing.T) {
MatchedProfiles: []string{"ATTR_Search_and_replace"},
AlteredFields: []string{"Category"},
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]interface{}{
"Category": "call_suffix",
},

View File

@@ -209,9 +209,8 @@ func testChargerSProcessEvent(t *testing.T) {
AttributeSProfiles: []string{"ATTR_1001_SIMPLEAUTH"},
AlteredFields: []string{"Password"},
CGREvent: &utils.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Context: utils.StringPointer(utils.MetaChargers),
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]interface{}{
utils.Account: "1001",
"Password": "CGRateS.org",

View File

@@ -798,13 +798,15 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
//AttributeProfile
func testV1FIdxCaProcessAttributeProfileEventWithNotFound(t *testing.T) {
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "3009",
utils.Destination: "+492511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "3009",
utils.Destination: "+492511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
@@ -870,13 +872,15 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1009",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "1009",
utils.Destination: "+491511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
@@ -888,13 +892,15 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) {
func testV1FIdxCaGetAttributeProfileFromTP(t *testing.T) {
//matches ATTR_1
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "1007",
utils.Destination: "+491511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "1007",
utils.Destination: "+491511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
@@ -959,13 +965,15 @@ func testV1FIdxCaUpdateAttributeProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "2009",
utils.Destination: "+492511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "2009",
utils.Destination: "+492511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
@@ -1011,13 +1019,15 @@ func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "3009",
utils.Destination: "+492511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "3009",
utils.Destination: "+492511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
@@ -1028,13 +1038,15 @@ func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) {
func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
var resp string
ev := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "3009",
utils.Destination: "+492511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "3009",
utils.Destination: "+492511231234",
},
},
}
var rplyEv engine.AttrSProcessEventReply
@@ -1042,13 +1054,15 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
t.Error(err)
}
ev2 := &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
ev2 := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
Event: map[string]interface{}{
utils.Account: "2009",
utils.Destination: "+492511231234",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
utils.Account: "2009",
utils.Destination: "+492511231234",
},
},
}
if err := tFIdxCaRpc.Call(utils.AttributeSv1ProcessEvent, ev2, &rplyEv); err != nil {

View File

@@ -187,9 +187,8 @@ func TestSSv1ItAuth(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]interface{}{
utils.CGRID: "5668666d6b8e44eb949042f25ce0796ec3592ff9",
utils.Tenant: "cgrates.org",
@@ -295,9 +294,8 @@ func TestSSv1ItInitiateSession(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]interface{}{
utils.CGRID: "5668666d6b8e44eb949042f25ce0796ec3592ff9",
utils.Tenant: "cgrates.org",
@@ -407,9 +405,8 @@ func TestSSv1ItUpdateSession(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]interface{}{
utils.CGRID: "5668666d6b8e44eb949042f25ce0796ec3592ff9",
utils.Tenant: "cgrates.org",
@@ -548,9 +545,8 @@ func TestSSv1ItProcessEvent(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]interface{}{
utils.CGRID: "c87609aa1cb6e9529ab1836cfeeeb0ab7aa7ebaf",
utils.Tenant: "cgrates.org",
@@ -699,9 +695,8 @@ func TestSSv1ItForceUpdateSession(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]interface{}{
utils.CGRID: "70876773b294f0e1476065f8d18bb9ec6bcb3d5f",
utils.Tenant: "cgrates.org",

View File

@@ -94,17 +94,19 @@ func testDspAttrPingFailover(t *testing.T) {
}
func testDspAttrGetAttrFailover(t *testing.T) {
args := &CGREvWithApiKey{
args := &ArgsAttrProcessEventWithApiKey{
DispatcherResource: DispatcherResource{
APIKey: "attr12345",
},
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
AttrArgsProcessEvent: engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
Event: map[string]interface{}{
utils.Account: "1002",
utils.EVENT_NAME: "Event1",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1002",
utils.EVENT_NAME: "Event1",
},
},
},
}
@@ -129,9 +131,8 @@ func testDspAttrGetAttrFailover(t *testing.T) {
MatchedProfiles: []string{"ATTR_1002_SIMPLEAUTH"},
AlteredFields: []string{"Password"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Context: utils.StringPointer("simpleauth"),
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1002",
utils.EVENT_NAME: "Event1",
@@ -204,13 +205,15 @@ func testDspAttrPing(t *testing.T) {
}
func testDspAttrTestMissingApiKey(t *testing.T) {
args := &CGREvWithApiKey{
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
args := &ArgsAttrProcessEventWithApiKey{
AttrArgsProcessEvent: engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
Event: map[string]interface{}{
utils.Account: "1001",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1001",
},
},
},
}
@@ -222,16 +225,18 @@ func testDspAttrTestMissingApiKey(t *testing.T) {
}
func testDspAttrTestUnknownApiKey(t *testing.T) {
args := &CGREvWithApiKey{
args := &ArgsAttrProcessEventWithApiKey{
DispatcherResource: DispatcherResource{
APIKey: "1234",
},
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
AttrArgsProcessEvent: engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
Event: map[string]interface{}{
utils.Account: "1001",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1001",
},
},
},
}
@@ -243,16 +248,18 @@ func testDspAttrTestUnknownApiKey(t *testing.T) {
}
func testDspAttrTestAuthKey(t *testing.T) {
args := &CGREvWithApiKey{
args := &ArgsAttrProcessEventWithApiKey{
DispatcherResource: DispatcherResource{
APIKey: "12345",
},
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
AttrArgsProcessEvent: engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
Event: map[string]interface{}{
utils.Account: "1001",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1001",
},
},
},
}
@@ -264,16 +271,18 @@ func testDspAttrTestAuthKey(t *testing.T) {
}
func testDspAttrTestAuthKey2(t *testing.T) {
args := &CGREvWithApiKey{
args := &ArgsAttrProcessEventWithApiKey{
DispatcherResource: DispatcherResource{
APIKey: "attr12345",
},
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
AttrArgsProcessEvent: engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
Event: map[string]interface{}{
utils.Account: "1001",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1001",
},
},
},
}
@@ -309,9 +318,8 @@ func testDspAttrTestAuthKey2(t *testing.T) {
MatchedProfiles: []string{"ATTR_1001_SIMPLEAUTH"},
AlteredFields: []string{"Password"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Context: utils.StringPointer("simpleauth"),
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1001",
"Password": "CGRateS.org",
@@ -330,17 +338,19 @@ func testDspAttrTestAuthKey2(t *testing.T) {
}
func testDspAttrTestAuthKey3(t *testing.T) {
args := &CGREvWithApiKey{
args := &ArgsAttrProcessEventWithApiKey{
DispatcherResource: DispatcherResource{
APIKey: "attr12345",
},
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
AttrArgsProcessEvent: engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
Event: map[string]interface{}{
utils.Account: "1001",
utils.EVENT_NAME: "Event1",
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
utils.Account: "1001",
utils.EVENT_NAME: "Event1",
},
},
},
}

View File

@@ -306,9 +306,8 @@ func testDspSessionUpdate(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]interface{}{
utils.Tenant: "cgrates.org",
utils.Category: "call",
@@ -447,9 +446,8 @@ func testDspSessionProcessEvent(t *testing.T) {
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"OfficeGroup"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Context: utils.StringPointer(utils.MetaSessionS),
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]interface{}{
"CGRID": "c87609aa1cb6e9529ab1836cfeeeb0ab7aa7ebaf",
utils.Tenant: "cgrates.org",