Eliminated profile from accounts from apiers in all tests

This commit is contained in:
porosnicuadrian
2021-04-08 15:40:18 +03:00
committed by Dan Christian Bogos
parent 07c10151a4
commit fb8c414773
25 changed files with 330 additions and 381 deletions

View File

@@ -40,7 +40,7 @@ func init() {
DestinationsCSVContent, TimingsCSVContent,
ResourcesCSVContent, StatsCSVContent, ThresholdsCSVContent, FiltersCSVContent,
RoutesCSVContent, AttributesCSVContent, ChargersCSVContent, DispatcherCSVContent,
DispatcherHostCSVContent, RateProfileCSVContent, ActionProfileCSVContent, AccountProfileCSVContent), testTPID, "", nil, nil, false)
DispatcherHostCSVContent, RateProfileCSVContent, ActionProfileCSVContent, AccountCSVContent), testTPID, "", nil, nil, false)
if err != nil {
log.Print("error when creating TpReader:", err)
}
@@ -900,7 +900,7 @@ func TestLoadAccount(t *testing.T) {
}
if len(csvr.accountProfiles) != 1 {
t.Fatalf("Failed to load ActionProfiles: %s", utils.ToJSON(csvr.actionProfiles))
t.Fatalf("Failed to load Accounts: %s", utils.ToJSON(csvr.actionProfiles))
}
accPrfKey := utils.TenantID{
Tenant: "cgrates.org",

View File

@@ -1044,7 +1044,7 @@ func testITAccountProfileIndexes(t *testing.T) {
"test_ID2": struct{}{},
},
}
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountProfilesFilterIndexes,
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountsFilterIndexes,
"cgrates.org", utils.EmptyString, false, false); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rcvIDx, eIdxes) {
@@ -1103,7 +1103,7 @@ func testITAccountProfileIndexes(t *testing.T) {
"test_ID2": struct{}{},
},
}
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountProfilesFilterIndexes,
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountsFilterIndexes,
"cgrates.org", utils.EmptyString, false, false); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rcvIDx, eIdxes) {
@@ -1116,7 +1116,7 @@ func testITAccountProfileIndexes(t *testing.T) {
"test_ID2": struct{}{},
},
}
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountProfilesFilterIndexes,
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountsFilterIndexes,
"cgrates.org", "*string:*req.Destination:DEST1", false, false); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rcvIDx, eIdxes) {
@@ -1153,7 +1153,7 @@ func testITAccountProfileIndexes(t *testing.T) {
"test_ID3": struct{}{},
},
}
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountProfilesFilterIndexes,
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountsFilterIndexes,
"cgrates.org", utils.EmptyString, false, false); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rcvIDx, eIdxes) {
@@ -1162,7 +1162,7 @@ func testITAccountProfileIndexes(t *testing.T) {
// here we will get the reverse indexing
eIdxes = map[string]utils.StringSet{
utils.CacheAccountProfilesFilterIndexes: {
utils.CacheAccountsFilterIndexes: {
"test_ID1": struct{}{},
"test_ID2": struct{}{},
},
@@ -1175,7 +1175,7 @@ func testITAccountProfileIndexes(t *testing.T) {
}
eIdxes = map[string]utils.StringSet{
utils.CacheAccountProfilesFilterIndexes: {
utils.CacheAccountsFilterIndexes: {
"test_ID3": struct{}{},
},
}
@@ -1188,7 +1188,7 @@ func testITAccountProfileIndexes(t *testing.T) {
//invalid tnt:context or index key
eIdxes = nil
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountProfilesFilterIndexes,
if rcvIDx, err := dataManager.GetIndexes(utils.CacheAccountsFilterIndexes,
"cgrates.org", "*string:*req.Destination:DEST6", false, false); err == nil || err != utils.ErrNotFound {
t.Errorf("Expected %+v, received %+v", utils.ErrNotFound, err)
} else if !reflect.DeepEqual(rcvIDx, eIdxes) {

View File

@@ -1445,7 +1445,7 @@ func testOnStorITAccountProfile(t *testing.T) {
}
//empty in database
if _, err := onStor.GetAccountProfile("cgrates.org", "RP1"); err != utils.ErrNotFound {
if _, err := onStor.GetAccount("cgrates.org", "RP1"); err != utils.ErrNotFound {
t.Error(err)
}
@@ -1453,7 +1453,7 @@ func testOnStorITAccountProfile(t *testing.T) {
if err := onStor.SetAccount(acctPrf, false); err != nil {
t.Error(err)
}
if rcv, err := onStor.GetAccountProfile("cgrates.org", "RP1"); err != nil {
if rcv, err := onStor.GetAccount("cgrates.org", "RP1"); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rcv, acctPrf) {
t.Errorf("Expecting: %v, received: %v", acctPrf, rcv)
@@ -1461,7 +1461,7 @@ func testOnStorITAccountProfile(t *testing.T) {
//craft akeysFromPrefix
expectedKey := []string{"anp_cgrates.org:RP1"}
if rcv, err := onStor.DataDB().GetKeysForPrefix(utils.AccountProfilePrefix); err != nil {
if rcv, err := onStor.DataDB().GetKeysForPrefix(utils.AccountPrefix); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(expectedKey, rcv) {
t.Errorf("Expecting: %v, received: %v", expectedKey, rcv)
@@ -1471,17 +1471,17 @@ func testOnStorITAccountProfile(t *testing.T) {
acctPrf.FilterIDs = []string{"*prefix:~*req.Destination:10"}
if err := onStor.SetAccount(acctPrf, false); err != nil {
t.Error(err)
} else if rcv, err := onStor.GetAccountProfile("cgrates.org", "RP1"); err != nil {
} else if rcv, err := onStor.GetAccount("cgrates.org", "RP1"); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(acctPrf, rcv) {
t.Errorf("Expecting: %v, received: %v", acctPrf, rcv)
}
//remove from database
if err := onStor.RemoveAccountProfile("cgrates.org", "RP1",
if err := onStor.RemoveAccount("cgrates.org", "RP1",
utils.NonTransactional, false); err != nil {
t.Error(err)
} else if _, err := onStor.GetAccountProfile("cgrates.org", "RP1"); err != utils.ErrNotFound {
} else if _, err := onStor.GetAccount("cgrates.org", "RP1"); err != utils.ErrNotFound {
t.Error(err)
}
}