mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add unit test in loader_csv_test for AccountProfile
This commit is contained in:
committed by
Dan Christian Bogos
parent
fd3defa7ef
commit
8e3bf6e945
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
// AttributeSv1Ping interogates AttributeS server responsible to process the event
|
||||
// AttributeSv1Ping interrogates AttributeS server responsible to process the event
|
||||
func (dS *DispatcherService) AttributeSv1Ping(args *utils.CGREventWithOpts,
|
||||
reply *string) (err error) {
|
||||
if args == nil {
|
||||
|
||||
@@ -299,6 +299,8 @@ cgrates.org,ONE_TIME_ACT,,,,,,,TOPUP_TEST_VOICE,,false,0s,*topup,,~*balance.Test
|
||||
|
||||
AccountProfileCSVContent = `
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Weight,BalanceID,BalanceFilterIDs,BalanceWeight,BalanceBlocker,BalanceType,BalanceOpts,BalanceValue
|
||||
cgrates.org,1001,,,20,MonetaryBalance,,10,,*monetary,,14
|
||||
cgrates.org,1001,,,,VoiceBalance,,10,,*voice,,3600000000000
|
||||
`
|
||||
)
|
||||
|
||||
|
||||
@@ -1625,3 +1625,41 @@ func TestLoadThresholds(t *testing.T) {
|
||||
t.Errorf("Failed to load thresholds: %s", utils.ToIJSON(csvr.thresholds))
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadAccountProfiles(t *testing.T) {
|
||||
expected := &utils.TPAccountProfile{
|
||||
TPid: testTPID,
|
||||
Tenant: "cgrates.org",
|
||||
ID: "1001",
|
||||
Weight: 20,
|
||||
Balances: []*utils.TPAccountBalance{
|
||||
&utils.TPAccountBalance{
|
||||
ID: "MonetaryBalance",
|
||||
FilterIDs: []string{},
|
||||
Weight: 10,
|
||||
Type: utils.MONETARY,
|
||||
Value: 14,
|
||||
},
|
||||
&utils.TPAccountBalance{
|
||||
ID: "VoiceBalance",
|
||||
FilterIDs: []string{},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if len(csvr.accountProfiles) != 1 {
|
||||
t.Fatalf("Failed to load ActionProfiles: %s", utils.ToJSON(csvr.actionProfiles))
|
||||
}
|
||||
accPrfKey := utils.TenantID{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "1001",
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(csvr.accountProfiles[accPrfKey], expected) {
|
||||
t.Errorf("Expecting: %+v,\n received: %+v",
|
||||
utils.ToJSON(expected), utils.ToJSON(csvr.accountProfiles[accPrfKey]))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user