mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 21:59:53 +05:00
Updated GetAttributeProfileIDs to return error when no tenant is given
This commit is contained in:
committed by
Dan Christian Bogos
parent
f9f97ce256
commit
08ded159a0
@@ -41,6 +41,9 @@ func (apierV1 *ApierV1) GetAttributeProfile(arg utils.TenantID, reply *engine.At
|
||||
|
||||
// GetAttributeProfileIDs returns list of attributeProfile IDs registered for a tenant
|
||||
func (apierV1 *ApierV1) GetAttributeProfileIDs(tenant string, attrPrfIDs *[]string) error {
|
||||
if tenant == "" {
|
||||
return utils.NewErrMandatoryIeMissing("Tenant")
|
||||
}
|
||||
prfx := utils.AttributeProfilePrefix + tenant + ":"
|
||||
keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx)
|
||||
if err != nil {
|
||||
|
||||
@@ -652,6 +652,9 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
|
||||
func testAttributeSGetAttPrfIDs(t *testing.T) {
|
||||
expected := []string{"ATTR_2", "ATTR_1", "ATTR_3", "ATTR_Header", "AttributeWithNonSubstitute"}
|
||||
var result []string
|
||||
if err := attrSRPC.Call("ApierV1.GetAttributeProfileIDs", "", &result); err == nil || err.Error() != utils.NewErrMandatoryIeMissing("Tenant").Error() {
|
||||
t.Errorf("Expected error recived reply %+v with err=%v", result, err)
|
||||
}
|
||||
if err := attrSRPC.Call("ApierV1.GetAttributeProfileIDs", "cgrates.org", &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(expected) != len(result) {
|
||||
|
||||
Reference in New Issue
Block a user