From 467e684ddf213f762a695cabb7ce677d008f6e7f Mon Sep 17 00:00:00 2001 From: TeoV Date: Fri, 15 Mar 2019 11:34:34 +0200 Subject: [PATCH] Consider ConnectFee in Cost tests --- apier/v1/costs_it_test.go | 2 +- apier/v1/suppliers_it_test.go | 4 ++-- dispatchers/suppliers_it_test.go | 12 ++++++------ general_tests/tutorial2_it_test.go | 8 ++++---- general_tests/tutorial_it_test.go | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apier/v1/costs_it_test.go b/apier/v1/costs_it_test.go index 01f6772e0..b00c00595 100644 --- a/apier/v1/costs_it_test.go +++ b/apier/v1/costs_it_test.go @@ -62,7 +62,7 @@ func TestCostIT(t *testing.T) { func testCostInitCfg(t *testing.T) { var err error costCfgPath = path.Join(costDataDir, "conf", "samples", costConfigDIR) - costCfg, err = config.NewCGRConfigFromFolder(costCfgPath) + costCfg, err = config.NewCGRConfigFromPath(costCfgPath) if err != nil { t.Error(err) } diff --git a/apier/v1/suppliers_it_test.go b/apier/v1/suppliers_it_test.go index d3f147823..7c4a2c5f4 100644 --- a/apier/v1/suppliers_it_test.go +++ b/apier/v1/suppliers_it_test.go @@ -204,7 +204,7 @@ func testV1SplSGetLeastCostSuppliers(t *testing.T) { { SupplierID: "supplier2", SortingData: map[string]interface{}{ - utils.Cost: 0.46666, + utils.Cost: 1.26666, utils.RatingPlanID: "RP_RETAIL1", utils.Weight: 20.0, }, @@ -359,7 +359,7 @@ func testV1SplSGetHighestCostSuppliers(t *testing.T) { { SupplierID: "supplier2", SortingData: map[string]interface{}{ - utils.Cost: 0.46666, + utils.Cost: 1.26666, utils.RatingPlanID: "RP_RETAIL1", utils.Weight: 20.0, }, diff --git a/dispatchers/suppliers_it_test.go b/dispatchers/suppliers_it_test.go index de199e9ba..b98837722 100755 --- a/dispatchers/suppliers_it_test.go +++ b/dispatchers/suppliers_it_test.go @@ -126,7 +126,7 @@ func testDspSupGetSupFailover(t *testing.T) { SupplierID: "supplier1", SupplierParameters: "", SortingData: map[string]interface{}{ - utils.Cost: 0.1166, + utils.Cost: 0.3166, utils.RatingPlanID: "RP_1002_LOW", utils.Weight: 10.0, }, @@ -135,7 +135,7 @@ func testDspSupGetSupFailover(t *testing.T) { SupplierID: "supplier2", SupplierParameters: "", SortingData: map[string]interface{}{ - utils.Cost: 0.2334, + utils.Cost: 0.6334, utils.RatingPlanID: "RP_1002", utils.Weight: 20.0, }, @@ -215,7 +215,7 @@ func testDspSupTestAuthKey2(t *testing.T) { SupplierID: "supplier1", SupplierParameters: "", SortingData: map[string]interface{}{ - utils.Cost: 0.1166, + utils.Cost: 0.3166, utils.RatingPlanID: "RP_1002_LOW", utils.Weight: 10.0, }, @@ -224,7 +224,7 @@ func testDspSupTestAuthKey2(t *testing.T) { SupplierID: "supplier2", SupplierParameters: "", SortingData: map[string]interface{}{ - utils.Cost: 0.2334, + utils.Cost: 0.6334, utils.RatingPlanID: "RP_1002", utils.Weight: 20.0, }, @@ -281,7 +281,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) { SupplierID: "supplier1", SupplierParameters: "", SortingData: map[string]interface{}{ - utils.Cost: 0.1166, + utils.Cost: 0.3166, utils.RatingPlanID: "RP_1002_LOW", utils.Weight: 10.0, }, @@ -290,7 +290,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) { SupplierID: "supplier2", SupplierParameters: "", SortingData: map[string]interface{}{ - utils.Cost: 0.2334, + utils.Cost: 0.6334, utils.RatingPlanID: "RP_1002", utils.Weight: 20.0, }, diff --git a/general_tests/tutorial2_it_test.go b/general_tests/tutorial2_it_test.go index a71fccdd9..24b62e77a 100644 --- a/general_tests/tutorial2_it_test.go +++ b/general_tests/tutorial2_it_test.go @@ -122,7 +122,7 @@ func testTutGetCost(t *testing.T) { var rply *engine.EventCost if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) - } else if *rply.Cost != 0.45 { // FixMe: missing ConnectFee out of Cost + } else if *rply.Cost != 0.550000 { t.Errorf("Unexpected cost received: %f", *rply.Cost) } // Fallback pricing from *any, Usage will be rounded to 60s @@ -134,7 +134,7 @@ func testTutGetCost(t *testing.T) { } if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) - } else if *rply.Cost != 1.2 { // FixMe: missing ConnectFee out of Cost + } else if *rply.Cost != 1.4 { t.Errorf("Unexpected cost received: %f", *rply.Cost) } // Fallback pricing from *any, Usage will be rounded to 60s @@ -167,7 +167,7 @@ func testTutGetCost(t *testing.T) { } if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) - } else if *rply.Cost != 0.45 { + } else if *rply.Cost != 0.55 { t.Errorf("Unexpected cost received: %f", *rply.Cost) } // Fallback pricing from *any, Usage will be rounded to 60s @@ -179,7 +179,7 @@ func testTutGetCost(t *testing.T) { } if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) - } else if *rply.Cost != 0.45 { // FixMe: missing ConnectFee out of Cost + } else if *rply.Cost != 0.55 { t.Errorf("Unexpected cost received: %f", *rply.Cost) } // Unauthorized destination diff --git a/general_tests/tutorial_it_test.go b/general_tests/tutorial_it_test.go index 73eda49e9..c5b4331e1 100644 --- a/general_tests/tutorial_it_test.go +++ b/general_tests/tutorial_it_test.go @@ -28,7 +28,7 @@ import ( "testing" "time" - "github.com/cgrates/cgrates/apier/v1" + v1 "github.com/cgrates/cgrates/apier/v1" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" @@ -136,7 +136,7 @@ func testTutorialGetCost(t *testing.T) { var rply *engine.EventCost if err := tutorialRpc.Call("ApierV1.GetCost", attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) - } else if *rply.Cost != 0.316900 { + } else if *rply.Cost != 0.716900 { t.Errorf("Unexpected cost received: %f", *rply.Cost) } }