Commit 2ce54fe3 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

common: Disable proxy in tests

Do not follow redirections in im tests.
parent cc0a5d4b
...@@ -1432,18 +1432,18 @@ class QuotaAPITest(TestCase): ...@@ -1432,18 +1432,18 @@ class QuotaAPITest(TestCase):
[resource11, resource12, resource21]] [resource11, resource12, resource21]]
# get resources # get resources
r = client.get(u('resources'), follow=True) r = client.get(u('resources'))
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
for name in resource_names: for name in resource_names:
assertIn(name, body) assertIn(name, body)
# get quota # get quota
r = client.get(u('quotas'), follow=True) r = client.get(u('quotas'))
self.assertEqual(r.status_code, 401) self.assertEqual(r.status_code, 401)
headers = {'HTTP_X_AUTH_TOKEN': user.auth_token} headers = {'HTTP_X_AUTH_TOKEN': user.auth_token}
r = client.get(u('quotas'), follow=True, **headers) r = client.get(u('quotas/'), **headers)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
system_quota = body['system'] system_quota = body['system']
...@@ -1451,16 +1451,16 @@ class QuotaAPITest(TestCase): ...@@ -1451,16 +1451,16 @@ class QuotaAPITest(TestCase):
for name in resource_names: for name in resource_names:
assertIn(name, system_quota) assertIn(name, system_quota)
r = client.get(u('service_quotas'), follow=True) r = client.get(u('service_quotas'))
self.assertEqual(r.status_code, 401) self.assertEqual(r.status_code, 401)
s1_headers = {'HTTP_X_AUTH_TOKEN': service1.auth_token} s1_headers = {'HTTP_X_AUTH_TOKEN': service1.auth_token}
r = client.get(u('service_quotas'), follow=True, **s1_headers) r = client.get(u('service_quotas'), **s1_headers)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
assertIn(user.uuid, body) assertIn(user.uuid, body)
r = client.get(u('commissions'), follow=True, **s1_headers) r = client.get(u('commissions'), **s1_headers)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
self.assertEqual(body, []) self.assertEqual(body, [])
...@@ -1529,13 +1529,12 @@ class QuotaAPITest(TestCase): ...@@ -1529,13 +1529,12 @@ class QuotaAPITest(TestCase):
body = json.loads(r.content) body = json.loads(r.content)
self.assertEqual(body['serial'], 3) self.assertEqual(body['serial'], 3)
r = client.get(u('commissions'), follow=True, **s1_headers) r = client.get(u('commissions'), **s1_headers)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
self.assertEqual(body, [1, 2, 3]) self.assertEqual(body, [1, 2, 3])
r = client.get(u('commissions/' + str(serial)), follow=True, r = client.get(u('commissions/' + str(serial)), **s1_headers)
**s1_headers)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
self.assertEqual(body['serial'], serial) self.assertEqual(body['serial'], serial)
...@@ -1543,8 +1542,7 @@ class QuotaAPITest(TestCase): ...@@ -1543,8 +1542,7 @@ class QuotaAPITest(TestCase):
self.assertEqual(body['provisions'], commission_request['provisions']) self.assertEqual(body['provisions'], commission_request['provisions'])
self.assertEqual(body['name'], commission_request['name']) self.assertEqual(body['name'], commission_request['name'])
r = client.get(u('service_quotas?user=' + user.uuid), r = client.get(u('service_quotas?user=' + user.uuid), **s1_headers)
follow=True, **s1_headers)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
body = json.loads(r.content) body = json.loads(r.content)
user_quota = body[user.uuid] user_quota = body[user.uuid]
...@@ -1569,8 +1567,7 @@ class QuotaAPITest(TestCase): ...@@ -1569,8 +1567,7 @@ class QuotaAPITest(TestCase):
failed = body['failed'] failed = body['failed']
self.assertEqual(len(failed), 2) self.assertEqual(len(failed), 2)
r = client.get(u('commissions/' + str(serial)), follow=True, r = client.get(u('commissions/' + str(serial)), **s1_headers)
**s1_headers)
self.assertEqual(r.status_code, 404) self.assertEqual(r.status_code, 404)
# auto accept # auto accept
...@@ -1599,8 +1596,7 @@ class QuotaAPITest(TestCase): ...@@ -1599,8 +1596,7 @@ class QuotaAPITest(TestCase):
serial = body['serial'] serial = body['serial']
self.assertEqual(serial, 4) self.assertEqual(serial, 4)
r = client.get(u('commissions/' + str(serial)), follow=True, r = client.get(u('commissions/' + str(serial)), **s1_headers)
**s1_headers)
self.assertEqual(r.status_code, 404) self.assertEqual(r.status_code, 404)
# malformed # malformed
......
...@@ -19,3 +19,6 @@ LOGIN_URL = 'http://host:port/' ...@@ -19,3 +19,6 @@ LOGIN_URL = 'http://host:port/'
SOUTH_TESTS_MIGRATE = bool(int(os.environ.get('SOUTH_TESTS_MIGRATE', True))) SOUTH_TESTS_MIGRATE = bool(int(os.environ.get('SOUTH_TESTS_MIGRATE', True)))
ASTAKOS_IM_MODULES = ['local', 'shibboleth'] ASTAKOS_IM_MODULES = ['local', 'shibboleth']
CYCLADES_PROXY_USER_SERVICES = False
PITHOS_PROXY_USER_SERVICES = False
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