diff --git a/apier/v1/chargers_it_test.go b/apier/v1/chargers_it_test.go index 86fe3d31d..b7ea785db 100755 --- a/apier/v1/chargers_it_test.go +++ b/apier/v1/chargers_it_test.go @@ -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", }, }, }, diff --git a/apier/v1/filters_it_test.go b/apier/v1/filters_it_test.go index 6260967bd..ef375a4e9 100644 --- a/apier/v1/filters_it_test.go +++ b/apier/v1/filters_it_test.go @@ -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) diff --git a/apier/v1/sessions_thresholds_it_test.go b/apier/v1/sessions_thresholds_it_test.go index 022dfeb6e..85bed8b63 100755 --- a/apier/v1/sessions_thresholds_it_test.go +++ b/apier/v1/sessions_thresholds_it_test.go @@ -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, diff --git a/dispatcher/chargers_it_test.go b/dispatcher/chargers_it_test.go index 5355afabf..83425e9de 100755 --- a/dispatcher/chargers_it_test.go +++ b/dispatcher/chargers_it_test.go @@ -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 diff --git a/dispatcher/sessions_it_test.go b/dispatcher/sessions_it_test.go index 3762e34df..7c99ac257 100755 --- a/dispatcher/sessions_it_test.go +++ b/dispatcher/sessions_it_test.go @@ -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", }, }, }