From 1c7500564302c547fdb9119897aa4e3984a06b7b Mon Sep 17 00:00:00 2001 From: porosnicuadrian Date: Thu, 23 Sep 2021 18:04:06 +0300 Subject: [PATCH] Fixed unit test for ExtRateSIncrement --- accounts/accounts_test.go | 1 - apis/account_test.go | 21 ++++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/accounts/accounts_test.go b/accounts/accounts_test.go index 2269dc3cd..b8af76076 100644 --- a/accounts/accounts_test.go +++ b/accounts/accounts_test.go @@ -20,7 +20,6 @@ package accounts import ( "bytes" - "fmt" "log" "os" "reflect" diff --git a/apis/account_test.go b/apis/account_test.go index 54dec0be8..a22a99a21 100644 --- a/apis/account_test.go +++ b/apis/account_test.go @@ -1177,16 +1177,17 @@ func TestAccountMaxAbstracts(t *testing.T) { { IncrementStart: nil, IntervalRateIndex: 0, - RateID: "", - CompressFactor: 0, + RateID: "id_for_Test", + CompressFactor: 1, Usage: nil, }, }, CompressFactor: 1, } for _, val := range rpEv.Rating { - if !reflect.DeepEqual(val, expRating) { - t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expRating, val) + val.Increments[0].RateID = "id_for_Test" + if !reflect.DeepEqual(expRating, val) { + t.Errorf("\nExpected <%+v>, \nReceived <%+v>", utils.ToJSON(expRating), utils.ToJSON(val)) } } rpEv.Rating = map[string]*utils.ExtRateSInterval{} @@ -1381,16 +1382,17 @@ func TestAccountDebitAbstracts(t *testing.T) { { IncrementStart: nil, IntervalRateIndex: 0, - RateID: "", - CompressFactor: 0, + RateID: "id_for_test", + CompressFactor: 1, Usage: nil, }, }, CompressFactor: 1, } for _, val := range rpEv.Rating { + val.Increments[0].RateID = "id_for_test" if !reflect.DeepEqual(val, expRating) { - t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expRating, val) + t.Errorf("\nExpected <%+v>, \nReceived <%+v>", utils.ToJSON(expRating), utils.ToJSON(val)) } } rpEv.Rating = map[string]*utils.ExtRateSInterval{} @@ -1585,14 +1587,15 @@ func TestAccountActionSetBalance(t *testing.T) { { IncrementStart: nil, IntervalRateIndex: 0, - RateID: "", - CompressFactor: 0, + RateID: "id_for_test", + CompressFactor: 1, Usage: nil, }, }, CompressFactor: 1, } for _, val := range rpEv.Rating { + val.Increments[0].RateID = "id_for_test" if !reflect.DeepEqual(val, expRating) { t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expRating, val) }