Consider ConnectFee in Cost tests

This commit is contained in:
TeoV
2019-03-15 11:34:34 +02:00
committed by Dan Christian Bogos
parent 5745a93e27
commit 467e684ddf
5 changed files with 15 additions and 15 deletions

View File

@@ -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)
}

View File

@@ -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,
},

View File

@@ -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,
},

View File

@@ -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

View File

@@ -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)
}
}