예제 #1
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)
예제 #2
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)
예제 #3
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")
예제 #4
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)")
예제 #5
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)")
예제 #6
0
 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)")
예제 #7
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)")
예제 #8
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)")
예제 #9
0
 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)")
예제 #10
0
 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")
예제 #11
0
 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)")
예제 #12
0
 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)")
예제 #13
0
 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)")