コード例 #1
0
def retrieve_user(token, astakos_auth_url, logger=None, client_ip=None):
    """Return user_info retrieved from astakos for the given token"""
    astakos_url = astakos_auth_url
    if astakos_url is None:
        try:
            astakos_url = settings.ASTAKOS_AUTH_URL
        except AttributeError:
            if logger:
                logger.error("Cannot authenticate without having"
                             " an Astakos Authentication URL")
            raise

    if not token:
        return None

    headers = None
    if client_ip:
        headers = {'X-Client-IP': client_ip}

    astakos = AstakosClient(token,
                            astakos_url,
                            use_pool=True,
                            retry=2,
                            logger=logger,
                            headers=headers)
    user_info = astakos.authenticate()

    return user_info
コード例 #2
0
ファイル: util.py プロジェクト: parisk/synnefo
def retrieve_uuids(token, displaynames, return_dict=False, fail_silently=True):
    astakos = AstakosClient(token, ASTAKOS_AUTH_URL, retry=2, use_pool=True, logger=logger)
    catalog = astakos.get_uuids(displaynames) or {}
    missing = list(set(displaynames) - set(catalog))
    if missing and not fail_silently:
        raise ItemNotExists("Unknown uuids: %s" % ", ".join(missing))
    return catalog if return_dict else [catalog.get(i) for i in displaynames]
コード例 #3
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_reject_commission(self):
     """Test function call of reject_commission"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.reject_commission(57)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
コード例 #4
0
 def _auth_user(self, token, user_info, usage, pool):
     _mock_request([_request_ok])
     try:
         client = AstakosClient("https://example.com", use_pool=pool)
         auth_info = client.get_user_info(token, usage=usage)
     except:
         self.fail("Shouldn't raise an Exception")
     self.assertEqual(user_info, auth_info)
コード例 #5
0
ファイル: util.py プロジェクト: cstavr/synnefo
def get_pithos_usage(token):
    """Get Pithos Usage from astakos."""
    astakos = AstakosClient(ASTAKOS_BASE_URL, retry=2, use_pool=True,
                            logger=logger)
    quotas = astakos.get_quotas(token)['system']
    pithos_resources = [r['name'] for r in resources]
    map(quotas.pop, filter(lambda k: k not in pithos_resources, quotas.keys()))
    return quotas.popitem()[-1] # assume only one resource
コード例 #6
0
ファイル: util.py プロジェクト: cstavr/synnefo
def retrieve_displaynames(token, uuids, return_dict=False, fail_silently=True):
    astakos = AstakosClient(ASTAKOS_BASE_URL, retry=2, use_pool=True,
                            logger=logger)
    catalog = astakos.get_usernames(token, uuids) or {}
    missing = list(set(uuids) - set(catalog))
    if missing and not fail_silently:
        raise ItemNotExists('Unknown displaynames: %s' % ', '.join(missing))
    return catalog if return_dict else [catalog.get(i) for i in uuids]
コード例 #7
0
 def _auth_user(self, pool):
     global token, endpoints_with_info, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         auth_info = client.authenticate()
     except Exception as err:
         self.fail("Shouldn't raise an Exception: %s" % err)
     self.assertEqual(endpoints_with_info, auth_info)
コード例 #8
0
 def test_reject_commission(self):
     """Test function call of reject_commission"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.reject_commission(57)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
コード例 #9
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _auth_user(self, pool):
     global token, endpoints_with_info, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         auth_info = client.authenticate()
     except Exception as err:
         self.fail("Shouldn't raise an Exception: %s" % err)
     self.assertEqual(endpoints_with_info, auth_info)
コード例 #10
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _invalid_url(self, pool):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         client._call_astakos("/astakos/api/misspelled")
     except NotFound:
         pass
     except Exception, e:
         self.fail("Got \"%s\" instead of 404" % e)
コード例 #11
0
ファイル: astakos.py プロジェクト: AthinaB/synnefo
def user_for_token(token, astakos_auth_url, logger=None):
    if token is None:
        return None
    client = AstakosClient(token, astakos_auth_url,
                           retry=2, use_pool=True, logger=logger)
    try:
        return client.authenticate()
    except Unauthorized:
        return None
コード例 #12
0
 def test_resolve_commissions(self):
     """Test function call of resolve_commissions"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         result = client.resolve_commissions([56, 57], [56, 58, 59])
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(result, resolve_commissions_rep)
コード例 #13
0
def retrieve_uuids(token, displaynames, return_dict=False, fail_silently=True):
    astakos = AstakosClient(token, ASTAKOS_AUTH_URL,
                            retry=2, use_pool=True,
                            logger=logger)
    catalog = astakos.get_uuids(displaynames) or {}
    missing = list(set(displaynames) - set(catalog))
    if missing and not fail_silently:
        raise ItemNotExists('Unknown uuids: %s' % ', '.join(missing))
    return catalog if return_dict else [catalog.get(i) for i in displaynames]
コード例 #14
0
 def _invalid_url(self, pool):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         client._call_astakos("/astakos/api/misspelled")
     except NotFound:
         pass
     except Exception, e:
         self.fail("Got \"%s\" instead of 404" % e)
コード例 #15
0
 def test_reject_commission(self):
     """Test function call of reject_commission"""
     global token_1
     _mock_request([_request_ok])
     try:
         client = AstakosClient("https://example.com")
         client.reject_commission(token_1, 57)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
コード例 #16
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_quotas(self):
     """Test function call of get_quotas"""
     global quotas, token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         result = client.get_quotas()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(quotas, result)
コード例 #17
0
 def test_get_uuid(self):
     """Test get_uuid"""
     global token, user, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, retry=1)
         catalog = client.get_uuids([user['name']])
     except:
         self.fail("Shouldn't raise an Exception")
     self.assertEqual(catalog[user['name']], user['id'])
コード例 #18
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_pending_commissions(self):
     """Test function call of get_pending_commissions"""
     global token, pending_commissions, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         response = client.get_pending_commissions()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, pending_commissions)
コード例 #19
0
 def test_get_resources(self):
     """Test function call of get_resources"""
     global resources, auth_url, token
     try:
         client = AstakosClient(token['id'], auth_url, retry=1)
         result = client.get_resources()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(resources, result)
コード例 #20
0
 def test_get_quotas(self):
     """Test function call of get_quotas"""
     global quotas, token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         result = client.get_quotas()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(quotas, result)
コード例 #21
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_resources(self):
     """Test function call of get_resources"""
     global resources, auth_url, token
     try:
         client = AstakosClient(token['id'], auth_url, retry=1)
         result = client.get_resources()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(resources, result)
コード例 #22
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_uuid(self):
     """Test get_uuid"""
     global token, user, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, retry=1)
         catalog = client.get_uuids([user['name']])
     except:
         self.fail("Shouldn't raise an Exception")
     self.assertEqual(catalog[user['name']], user['id'])
コード例 #23
0
 def test_get_pending_commissions(self):
     """Test function call of get_pending_commissions"""
     global token, pending_commissions, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         response = client.get_pending_commissions()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, pending_commissions)
コード例 #24
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_username(self):
     """Test get_username"""
     global token, user, auth_url
     try:
         client = AstakosClient(token['id'], auth_url,
                                use_pool=False, retry=2)
         info = client.get_username(user['id'])
     except Exception, e:
         self.fail("Shouldn't raise an Exception: %s" % e)
コード例 #25
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_resolve_commissions(self):
     """Test function call of resolve_commissions"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         result = client.resolve_commissions([56, 57], [56, 58, 59])
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(result, resolve_commissions_rep)
コード例 #26
0
ファイル: tests.py プロジェクト: vgerak/synnefo
 def test_username(self):
     """Test get_username"""
     global token, user, auth_url
     try:
         client = AstakosClient(token['id'], auth_url,
                                use_pool=False, retry=2)
         info = client.get_username(user['id'])
     except Exception, e:
         self.fail("Shouldn't raise an Exception: %s" % e)
コード例 #27
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_commission_info(self):
     """Test function call of get_commission_info"""
     global token, commission_description, auth_url
     try:
         client = AstakosClient(token['id'], auth_url,
                                use_pool=True, pool_size=2)
         response = client.get_commission_info(57)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, commission_description)
コード例 #28
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_issue_commission(self):
     """Test function call of issue_commission"""
     global token, commission_request, commission_successful_reqsponse
     global auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         response = client._issue_commission(commission_request)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, commission_successful_response['serial'])
コード例 #29
0
 def _offline(self, pool):
     global token_1
     _mock_request([_request_offline])
     try:
         client = AstakosClient("https://example.com", use_pool=pool)
         client._call_astakos(token_1, astakosclient.API_AUTHENTICATE)
     except AstakosClientException:
         pass
     else:
         self.fail("Should have raised AstakosClientException")
コード例 #30
0
 def test_issue_commission(self):
     """Test function call of issue_commission"""
     global token_1, commission_request, commission_successful_reqsponse
     _mock_request([_request_ok])
     try:
         client = AstakosClient("https://example.com")
         response = client.issue_commission(token_1, commission_request)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, commission_successful_response['serial'])
コード例 #31
0
 def test_issue_commission(self):
     """Test function call of issue_commission"""
     global token, commission_request, commission_successful_reqsponse
     global auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         response = client._issue_commission(commission_request)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, commission_successful_response['serial'])
コード例 #32
0
 def test_get_quotas(self):
     """Test function call of get_quotas"""
     global quotas, token_1
     _mock_request([_request_ok])
     try:
         client = AstakosClient("https://example.com")
         result = client.get_quotas(token_1)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(quotas, result)
コード例 #33
0
 def test_get_uuid_user_two(self):
     """Test get_uuid for User Two"""
     global token_1, user_2
     _mock_request([_request_offline, _request_ok])
     try:
         client = AstakosClient("https://example.com", retry=1)
         info = client.get_uuid(token_2, user_1['username'])
     except:
         self.fail("Shouldn't raise an Exception")
     self.assertEqual(info, user_1['uuid'])
コード例 #34
0
 def test_get_resources(self):
     """Test function call of get_resources"""
     global resources
     _mock_request([_request_offline, _request_ok])
     try:
         client = AstakosClient("https://example.com", retry=1)
         result = client.get_resources()
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(resources, result)
コード例 #35
0
 def test_offline_retry(self):
     """Test retry functionality for getUserInfo"""
     global token_1, user_1
     _mock_request([_request_offline, _request_offline, _request_ok])
     try:
         client = AstakosClient("https://example.com", retry=2)
         auth_info = client.get_user_info(token_1, usage=True)
     except:
         self.fail("Shouldn't raise an Exception")
     self.assertEqual(user_1, auth_info)
コード例 #36
0
 def test_get_endpoints(self):
     """Test function call of get_endpoints"""
     global token_1, user_info_endpoints
     _mock_request([_request_ok])
     try:
         client = AstakosClient("https://example.com")
         response = client.get_endpoints(token_1)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, user_info_endpoints)
コード例 #37
0
ファイル: util.py プロジェクト: mpastyl/websocket-console
def get_pithos_usage(token):
    """Get Pithos Usage from astakos."""
    astakos = AstakosClient(ASTAKOS_BASE_URL,
                            retry=2,
                            use_pool=True,
                            logger=logger)
    quotas = astakos.get_quotas(token)['system']
    pithos_resources = [r['name'] for r in resources]
    map(quotas.pop, filter(lambda k: k not in pithos_resources, quotas.keys()))
    return quotas.popitem()[-1]  # assume only one resource
コード例 #38
0
 def test_resolve_commissions(self):
     """Test function call of resolve_commissions"""
     global token_1
     _mock_request([_request_ok])
     try:
         client = AstakosClient("https://example.com")
         result = client.resolve_commissions(token_1, [56, 57], [56, 58, 59])
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(result, resolve_commissions_rep)
コード例 #39
0
ファイル: util.py プロジェクト: parisk/synnefo
def retrieve_uuid(token, displayname):
    if is_uuid(displayname):
        return displayname

    astakos = AstakosClient(token, ASTAKOS_AUTH_URL, retry=2, use_pool=True, logger=logger)
    try:
        uuid = astakos.get_uuid(displayname)
    except NoUUID:
        raise ItemNotExists(displayname)
    return uuid
コード例 #40
0
ファイル: tests.py プロジェクト: vgerak/synnefo
 def test_get_commission_info(self):
     """Test function call of get_commission_info"""
     global token, commission_description, auth_url
     try:
         client = AstakosClient(token['id'], auth_url,
                                use_pool=True, pool_size=2)
         response = client.get_commission_info(57)
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     self.assertEqual(response, commission_description)
コード例 #41
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_no_username(self):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.get_username("1234")
     except NoUserName:
         pass
     except:
         self.fail("Should have raised NoDisplayName exception")
     else:
         self.fail("Should have raised NoDisplayName exception")
コード例 #42
0
 def test_username_user_one(self):
     """Test get_username for User One"""
     global token_2, user_1
     _mock_request([_request_offline, _request_ok])
     try:
         client = AstakosClient(
             "https://example.com", use_pool=True, retry=2)
         info = client.get_username(token_2, user_1['uuid'])
     except:
         self.fail("Shouldn't raise an Exception")
     self.assertEqual(info, user_1['username'])
コード例 #43
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _get_user_catalogs(self, pool):
     global token, auth_url, api_usercatalogs
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         client._call_astakos(api_usercatalogs)
     except BadRequest:
         pass
     except Exception:
         self.fail("Should have returned 400 (Method not allowed)")
     else:
         self.fail("Should have returned 400 (Method not allowed)")
コード例 #44
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _get_authenticate(self, pool):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         client._call_astakos(api_tokens, method="GET")
     except BadRequest:
         pass
     except Exception:
         self.fail("Should have returned 400 (Method not allowed)")
     else:
         self.fail("Should have returned 400 (Method not allowed)")
コード例 #45
0
ファイル: tests.py プロジェクト: antonis-m/synnefo
 def test_issue_one_commission(self):
     """Test function call of issue_one_commission"""
     global token, commission_successful_response, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         response = client.issue_one_commission(
             "c02f315b-7d84-45bc-a383-552a3f97d2ad",
             "system", {"cyclades.vm": 1, "cyclades.ram": 30000})
     except Exception as err:
         self.fail("Shouldn't have raised Exception %s" % err)
     self.assertEqual(response, commission_successful_response['serial'])
コード例 #46
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _http_scheme(self, pool):
     global token
     http_auth_url = "http://example.org/identity/v2.0"
     try:
         client = AstakosClient(token['id'], http_auth_url, use_pool=pool)
         client.authenticate()
     except AstakosClientException as err:
         if err.status != 302:
             self.fail("Should have returned 302 (Found)")
     else:
         self.fail("Should have returned 302 (Found)")
コード例 #47
0
ファイル: util.py プロジェクト: parisk/synnefo
def retrieve_displayname(token, uuid, fail_silently=True):
    astakos = AstakosClient(token, ASTAKOS_AUTH_URL, retry=2, use_pool=True, logger=logger)
    try:
        displayname = astakos.get_username(uuid)
    except NoUserName:
        if not fail_silently:
            raise ItemNotExists(uuid)
        else:
            # just return the uuid
            return uuid
    return displayname
コード例 #48
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_no_uuid(self):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.get_uuid("1234")
     except NoUUID:
         pass
     except:
         self.fail("Should have raised NoUUID exception")
     else:
         self.fail("Should have raised NoUUID exception")
コード例 #49
0
 def _get_user_catalogs(self, pool):
     global token, auth_url, api_usercatalogs
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         client._call_astakos(api_usercatalogs)
     except BadRequest:
         pass
     except Exception:
         self.fail("Should have returned 400 (Method not allowed)")
     else:
         self.fail("Should have returned 400 (Method not allowed)")
コード例 #50
0
 def test_no_uuid(self):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.get_uuid("1234")
     except NoUUID:
         pass
     except:
         self.fail("Should have raised NoUUID exception")
     else:
         self.fail("Should have raised NoUUID exception")
コード例 #51
0
 def test_no_username(self):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.get_username("1234")
     except NoUserName:
         pass
     except:
         self.fail("Should have raised NoDisplayName exception")
     else:
         self.fail("Should have raised NoDisplayName exception")
コード例 #52
0
 def _get_authenticate(self, pool):
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url, use_pool=pool)
         client._call_astakos(api_tokens, method="GET")
     except BadRequest:
         pass
     except Exception:
         self.fail("Should have returned 400 (Method not allowed)")
     else:
         self.fail("Should have returned 400 (Method not allowed)")
コード例 #53
0
 def _http_scheme(self, pool):
     global token
     http_auth_url = "http://example.org/identity/v2.0"
     try:
         client = AstakosClient(token['id'], http_auth_url, use_pool=pool)
         client.authenticate()
     except AstakosClientException as err:
         if err.status != 302:
             self.fail("Should have returned 302 (Found)")
     else:
         self.fail("Should have returned 302 (Found)")
コード例 #54
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_commission_info_not_found(self):
     """Test function call of get_commission_info with invalid serial"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.get_commission_info("57lala")
     except NotFound:
         pass
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     else:
         self.fail("Should have raised NotFound")
コード例 #55
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_commision_action(self):
     """Test function call of commision_action with wrong action"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.commission_action(57, "lala")
     except BadRequest:
         pass
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     else:
         self.fail("Should have raised BadRequest")
コード例 #56
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_commission_info_without_serial(self):
     """Test function call of get_commission_info without serial"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.get_commission_info(None)
     except BadValue:
         pass
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     else:
         self.fail("Should have raise BadValue")
コード例 #57
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _unsupported_scheme(self, pool):
     global token, auth_url
     try:
         client = AstakosClient(
             token['id'], "ftp://example.com", use_pool=pool)
         client.authenticate()
     except BadValue:
         pass
     except Exception:
         self.fail("Should have raise BadValue Exception")
     else:
         self.fail("Should have raise BadValue Exception")
コード例 #58
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def _invalid_token(self, pool):
     global auth_url
     token = "skaksaFlBl+fasFdaf24sx"
     try:
         client = AstakosClient(token, auth_url, use_pool=pool)
         client.authenticate()
     except Unauthorized:
         pass
     except Exception:
         self.fail("Should have returned 401 (Invalid X-Auth-Token)")
     else:
         self.fail("Should have returned 401 (Invalid X-Auth-Token)")
コード例 #59
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_accept_commission_not_found(self):
     """Test function call of accept_commission with wrong serial"""
     global token, auth_url
     try:
         client = AstakosClient(token['id'], auth_url)
         client.reject_commission(20)
     except NotFound:
         pass
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     else:
         self.fail("Should have raised NotFound")
コード例 #60
0
ファイル: tests.py プロジェクト: AthinaB/synnefo
 def test_get_quotas_unauthorized(self):
     """Test function call of get_quotas with wrong token"""
     global auth_url
     token = "buahfhsda"
     try:
         client = AstakosClient(token, auth_url)
         client.get_quotas()
     except Unauthorized:
         pass
     except Exception as err:
         self.fail("Shouldn't raise Exception %s" % err)
     else:
         self.fail("Should have raised Unauthorized Exception")