Separate Inventory Source API vs RBAC testing

Introduced new decorator for patching an access method,
does legwork of inserting into access registry so that
tests that test the API can mock RBAC behavior.
This commit is contained in:
AlanCoding
2017-06-23 15:16:37 -04:00
parent 30ec070357
commit 066dc4a5f0
4 changed files with 44 additions and 11 deletions

View File

@@ -95,7 +95,7 @@ def check_user_access(user, model_class, action, *args, **kwargs):
continue
result = access_method(*args, **kwargs)
logger.debug('%s.%s %r returned %r', access_instance.__class__.__name__,
access_method.__name__, args, result)
getattr(access_method, '__name__', 'unknown'), args, result)
if result:
return result
return False