Beispiel #1
0
 def test_init_auth(self, create_context, get_user, impersonate_token):
     os.environ[
         POLYAXON_KEYS_RUN_INSTANCE] = "owner.project.runs.{}".format(
             uuid.uuid4().hex)
     create_auth_context()
     assert impersonate_token.call_count == 1
     assert create_context.call_count == 1
     assert get_user.call_count == 1
     del os.environ[POLYAXON_KEYS_RUN_INSTANCE]
Beispiel #2
0
 def test_init_auth(self, create_context, get_user, impersonate_token):
     settings.CLIENT_CONFIG.is_managed = True
     os.environ[POLYAXON_KEYS_RUN_INSTANCE] = "owner.project.runs.{}".format(
         uuid.uuid4().hex
     )
     create_auth_context()
     assert impersonate_token.call_count == 1
     assert create_context.call_count == 1
     assert get_user.call_count == 1
     del os.environ[POLYAXON_KEYS_RUN_INSTANCE]
     settings.CLIENT_CONFIG.is_managed = None
Beispiel #3
0
 def test_raise_if_env_var_not_correct(self):
     os.environ[POLYAXON_KEYS_RUN_INSTANCE] = "foo"
     with self.assertRaises(PolyaxonContainerException):
         create_auth_context()
     del os.environ[POLYAXON_KEYS_RUN_INSTANCE]
Beispiel #4
0
 def test_raise_if_env_var_not_found(self):
     with self.assertRaises(PolyaxonContainerException):
         create_auth_context()
Beispiel #5
0
def auth():
    """Create auth context."""
    from polyaxon.init.auth import create_auth_context

    create_auth_context()