def test_get_key_path_gc_credentials(self, service_account):

        with self.assertRaises(PolyaxonStoresException):
            get_gc_credentials(key_path="key_path")

        service_account.return_value = None
        credentials = get_gc_credentials(key_path="key_path.json")
        assert service_account.call_count == 1
        assert credentials is None
Exemple #2
0
    def test_get_keyfile_dict_gc_credentials(self, service_account):
        with self.assertRaises(PolyaxonStoresException):
            get_gc_credentials(keyfile_dict="keyfile_dict")

        service_account.return_value = None

        credentials = get_gc_credentials(keyfile_dict={"private_key": "key"})
        assert service_account.call_count == 1
        assert credentials is None

        credentials = get_gc_credentials(keyfile_dict='{"private_key": "private_key"}')
        assert service_account.call_count == 2
        assert credentials is None
 def test_get_default_gc_credentials(self, default_auth):
     default_auth.return_value = None, None
     credentials = get_gc_credentials()
     assert default_auth.call_count == 1
     assert credentials is None