mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
aliases tests
This commit is contained in:
@@ -153,9 +153,6 @@ func TestGetRPAliases(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemRSubjAliases(t *testing.T) {
|
||||
if err := ratingStorage.SetRpAlias(utils.RatingSubjectAliasKey("cgrates.org", "2001"), "1001"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := ratingStorage.SetRpAlias(utils.RatingSubjectAliasKey("cgrates.org", "2002"), "1001"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -177,6 +174,24 @@ func TestRemRSubjAliases(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageRpAliases(t *testing.T) {
|
||||
if _, err := ratingStorage.GetRpAlias("cgrates.org:1991", true); err == nil {
|
||||
t.Error("Found alias before setting")
|
||||
}
|
||||
if err := ratingStorage.SetRpAlias(utils.RatingSubjectAliasKey("cgrates.org", "1991"), "1991"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err := ratingStorage.GetRpAlias("cgrates.org:1991", true); err != nil {
|
||||
t.Error("Alias not found after setting")
|
||||
}
|
||||
if err := ratingStorage.RemoveRpAliases([]*TenantRatingSubject{&TenantRatingSubject{Tenant: "cgrates.org", Subject: "1991"}}); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err := ratingStorage.GetRpAlias("cgrates.org:1991", true); err == nil {
|
||||
t.Error("Found alias after removing")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAccountAliases(t *testing.T) {
|
||||
if err := ratingStorage.SetAccAlias(utils.AccountAliasKey("cgrates.org", "2001"), "1001"); err != nil {
|
||||
t.Error(err)
|
||||
@@ -200,6 +215,24 @@ func TestGetAccountAliases(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageAccAliases(t *testing.T) {
|
||||
if _, err := ratingStorage.GetAccAlias("cgrates.org:1991", true); err == nil {
|
||||
t.Error("Found alias before setting")
|
||||
}
|
||||
if err := ratingStorage.SetAccAlias(utils.AccountAliasKey("cgrates.org", "1991"), "1991"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err := ratingStorage.GetAccAlias("cgrates.org:1991", true); err != nil {
|
||||
t.Error("Alias not found after setting")
|
||||
}
|
||||
if err := ratingStorage.RemoveAccAliases([]*TenantAccount{&TenantAccount{Tenant: "cgrates.org", Account: "1991"}}); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err := ratingStorage.GetAccAlias("cgrates.org:1991", true); err == nil {
|
||||
t.Error("Found alias after removing")
|
||||
}
|
||||
}
|
||||
|
||||
/************************** Benchmarks *****************************/
|
||||
|
||||
func GetUB() *Account {
|
||||
|
||||
Reference in New Issue
Block a user