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)
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)
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")
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)")
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)")
def _http_scheme(self, pool): global token_1 _mock_request([_request_ok]) try: client = AstakosClient("http://example.com", use_pool=pool) client._call_astakos(token_1, astakosclient.API_AUTHENTICATE) except AstakosClientException as err: if err.status != 302: self.fail("Should have returned 302 (Found)") else: self.fail("Should have returned 302 (Found)")
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)")
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)")
def _get_user_catalogs(self, pool): global token_1 _mock_request([_request_ok]) try: client = AstakosClient("https://example.com", use_pool=pool) client._call_astakos(token_1, astakosclient.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)")
def _unsupported_scheme(self, pool): global token_1 _mock_request([_request_ok]) try: client = AstakosClient("ftp://example.com", use_pool=pool) client._call_astakos(token_1, astakosclient.API_AUTHENTICATE) except BadValue: pass except Exception: self.fail("Should have raise BadValue Exception") else: self.fail("Should have raise BadValue Exception")
def _invalid_url(self, pool): global token_1 _mock_request([_request_ok]) try: client = AstakosClient("https://example.com", use_pool=pool) client._call_astakos(token_1, "/astakos/api/misspelled") except NotFound: pass except Exception: self.fail("Should have returned 404 (Not Found)") else: self.fail("Should have returned 404 (Not Found)")
def _invalid_token(self, pool): token = "skaksaFlBl+fasFdaf24sx" _mock_request([_request_ok]) try: client = AstakosClient("https://example.com", use_pool=pool) client._call_astakos(token, astakosclient.API_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)")
def _post_authenticate(self, pool): global token_1 _mock_request([_request_ok]) try: client = AstakosClient("https://example.com", use_pool=pool) client._call_astakos( token_1, astakosclient.API_AUTHENTICATE, method="POST") except BadRequest: pass except Exception: self.fail("Should have returned 400 (Method not allowed)") else: self.fail("Should have returned 400 (Method not allowed)")