def setUp(self): super().setUp() self.patch(auth, 'validate_user_external_auth').return_value = True Config.objects.set_config('rbac_url', 'http://rbac.example.com') self.rbac_client = FakeRBACClient() rbac._store.client = self.rbac_client rbac._store.cleared = False # Prevent re-creation of the client. self.store = self.rbac_client.store self.become_admin()
def _setUp(self): # Must be called inside a transaction. assert connection.in_atomic_block Config.objects.set_config('rbac_url', 'http://rbac.example.com') client = FakeRBACClient() rbac._store.client = client rbac._store.cleared = False self.store = client.store def cleanup(): rbac._store.client = None rbac.clear() self.addCleanup(cleanup)
def _setUp(self): # Must be called inside a transaction. assert connection.in_atomic_block Config.objects.set_config('rbac_url', 'http://rbac.example.com') Config.objects.set_config('external_auth_url', 'https://auth.example.com') Config.objects.set_config('external_auth_user', 'user@candid') Config.objects.set_config( 'external_auth_key', 'x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY=') client = FakeRBACClient() rbac._store.client = client rbac._store.cleared = False self.store = client.store def cleanup(): rbac._store.client = None rbac.clear() self.addCleanup(cleanup)
def enable_rbac(self): Config.objects.set_config("rbac_url", "http://rbac.example.com") client = FakeRBACClient() rbac._store.client = client rbac._store.cleared = False # Prevent re-creation of the client self.rbac_store = client.store