Commit 383e5dbf authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis Committed by Christos Stavrakakis

Unit test user_catalogs without POST method

parent 2f95d284
......@@ -135,8 +135,16 @@ def _reqAuthenticate(conn, method, url, **kwargs):
def _reqCatalogs(conn, method, url, **kwargs):
"""Return user catalogs"""
# XXX: not implemented yet
return [{}]
global token_1, token_2, user_1, user_2
if conn.__class__.__name__ != "HTTPSConnection":
return _requestStatus302(conn, method, url, **kwargs)
if method != "POST":
return _requestStatus400(conn, method, url, **kwargs)
# XXX:
return (200, {})
# ----------------------------
......@@ -364,6 +372,28 @@ class TestCallAstakos(unittest.TestCase):
"""Test _postAuthenticate using pool"""
self._postAuthenticate(True)
# ----------------------------------
# Test the response if we request user_catalogs with GET
def _getUserCatalogs(self, pool):
global token_1
_mockRequest([_requestOk])
try:
astakosclient._callAstakos(
token_1, "https://example.com/user_catalogs", use_pool=pool)
except Exception as (status, data):
if status != 400:
self.fail("Should have returned 400 (Method not allowed)")
else:
self.fail("Should have returned 400 (Method not allowed)")
def test_GetUserCatalogs(self):
"""Test _getUserCatalogs without pool"""
self._getUserCatalogs(False)
def test_GetUserCatalogsPool(self):
"""Test _getUserCatalogs using pool"""
self._getUserCatalogs(True)
class TestAuthenticate(unittest.TestCase):
"""Test cases for function authenticate"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment