diff --git a/apier/v1/attributes.go b/apier/v1/attributes.go index 9ac336721..56bf99762 100644 --- a/apier/v1/attributes.go +++ b/apier/v1/attributes.go @@ -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 { diff --git a/apier/v1/attributes_it_test.go b/apier/v1/attributes_it_test.go index d01c2c1e1..ea68df680 100644 --- a/apier/v1/attributes_it_test.go +++ b/apier/v1/attributes_it_test.go @@ -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) {