Update integration test after merge

This commit is contained in:
TeoV
2018-10-05 10:23:40 -04:00
committed by Dan Christian Bogos
parent ab227ff924
commit e5eb78e951
5 changed files with 55 additions and 28 deletions

View File

@@ -66,7 +66,7 @@ var sTestsCharger = []func(t *testing.T){
testChargerSResetStorDb,
testChargerSStartEngine,
testChargerSRPCConn,
testChargerSLoadFromFolder,
testChargerSLoadAddCharger,
testChargerSGetChargersForEvent,
testChargerSProcessEvent,
testChargerSSetChargerProfile,
@@ -138,13 +138,49 @@ func testChargerSRPCConn(t *testing.T) {
}
}
func testChargerSLoadFromFolder(t *testing.T) {
var reply string
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
if err := chargerRPC.Call("ApierV1.LoadTariffPlanFromFolder", attrs, &reply); err != nil {
t.Error(err)
func testChargerSLoadAddCharger(t *testing.T) {
chargerProfile := &engine.ChargerProfile{
Tenant: "cgrates.org",
ID: "Charger1",
FilterIDs: []string{"*string:Account:1001"},
ActivationInterval: &utils.ActivationInterval{
ActivationTime: time.Date(2014, 7, 29, 15, 0, 0, 0, time.UTC),
},
RunID: "*default",
AttributeIDs: []string{"ATTR_1001_SIMPLEAUTH"},
Weight: 20,
}
var result string
if err := chargerRPC.Call("ApierV1.SetChargerProfile", chargerProfile, &result); err != nil {
t.Error(err)
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
alsPrf = &engine.AttributeProfile{
Tenant: "cgrates.org",
ID: "ATTR_1001_SIMPLEAUTH",
Contexts: []string{"simpleauth"},
Attributes: []*engine.Attribute{
&engine.Attribute{
FieldName: "Password",
Initial: utils.ANY,
Substitute: config.RSRParsers{
&config.RSRParser{
Rules: "CGRateS.org",
AllFiltersMatch: true,
},
},
Append: true,
},
},
Blocker: false,
Weight: 10,
}
if err := chargerRPC.Call("ApierV1.SetAttributeProfile", alsPrf, &result); err != nil {
t.Error(err)
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
time.Sleep(500 * time.Millisecond)
}
func testChargerSGetChargersForEvent(t *testing.T) {
@@ -156,7 +192,7 @@ func testChargerSGetChargersForEvent(t *testing.T) {
ActivationInterval: &utils.ActivationInterval{
ActivationTime: time.Date(2014, 7, 29, 15, 0, 0, 0, time.UTC),
},
RunID: "*rated",
RunID: "*default",
AttributeIDs: []string{"ATTR_1001_SIMPLEAUTH"},
Weight: 20,
},
@@ -169,7 +205,7 @@ func testChargerSGetChargersForEvent(t *testing.T) {
if err := chargerRPC.Call(utils.ChargerSv1GetChargersForEvent, chargerEvent[0], &result); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(result, chargerProfiles) {
t.Errorf("Expecting : %+v, received: %+v", chargerProfiles, result)
t.Errorf("Expecting : %+v, received: %+v", utils.ToJSON(chargerProfiles), utils.ToJSON(result))
}
}
@@ -186,7 +222,7 @@ func testChargerSProcessEvent(t *testing.T) {
Event: map[string]interface{}{
utils.Account: "1001",
"Password": "CGRateS.org",
"RunID": "*rated",
"RunID": "*default",
},
},
},

View File

@@ -73,13 +73,6 @@ func TestFilterITMongo(t *testing.T) {
}
}
func TestFilterITPG(t *testing.T) {
filterConfigDIR = "tutpostgres"
for _, stest := range sTestsFilter {
t.Run(filterConfigDIR, stest)
}
}
func testFilterInitCfg(t *testing.T) {
var err error
filterCfgPath = path.Join(filterDataDir, "conf", "samples", filterConfigDIR)

View File

@@ -271,7 +271,7 @@ func TestSessionSv1ItInitiateSession(t *testing.T) {
utils.MONETARY: []*engine.Balance{
&engine.Balance{
//Uuid: "c9a2c620-5256-483a-a92d-c51e94bb7667",
Value: 29.949000,
Value: 29.898000,
Directions: utils.StringMap{
"*out": true},
Weight: 10,
@@ -331,7 +331,7 @@ func TestSessionSv1ItTerminateSession(t *testing.T) {
utils.MONETARY: []*engine.Balance{
&engine.Balance{
//Uuid: "c9a2c620-5256-483a-a92d-c51e94bb7667",
Value: 39.898000,
Value: 39.796000,
Directions: utils.StringMap{
"*out": true},
Weight: 10,

View File

@@ -247,15 +247,12 @@ func testDspCppTestAuthKey2(t *testing.T) {
}
eChargers := &engine.ChargerProfiles{
&engine.ChargerProfile{
Tenant: "cgrates.org",
ID: "Charger1",
FilterIDs: []string{"*string:Account:1001"},
ActivationInterval: &utils.ActivationInterval{
ActivationTime: time.Date(2014, 7, 29, 15, 0, 0, 0, time.UTC),
},
RunID: "*rated",
AttributeIDs: []string{"ATTR_1001_SIMPLEAUTH"},
Weight: 20,
Tenant: "cgrates.org",
ID: "DEFAULT",
FilterIDs: []string{},
RunID: "*default",
AttributeIDs: []string{"*none"},
Weight: 0,
},
}
var reply *engine.ChargerProfiles

View File

@@ -391,6 +391,7 @@ func testDspSessionUpdate(t *testing.T) {
utils.SetupTime: "2018-01-07T17:00:00Z",
utils.AnswerTime: "2018-01-07T17:00:10Z",
utils.Usage: 300000000000.0,
"CGRID": "5668666d6b8e44eb949042f25ce0796ec3592ff9",
},
},
}