Commit a04e5fd0 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

astakos: allow empty tenantName in POST /tokens

parent 74be46f4
......@@ -87,7 +87,7 @@ def authenticate(request):
if user.uuid != uuid:
raise faults.Unauthorized('Invalid credentials')
if tenant is not None:
if tenant:
if user.uuid != tenant:
raise faults.BadRequest('Not conforming tenantName')
......
......@@ -542,6 +542,14 @@ class TokensApiTest(TestCase):
self.assertEqual(body['badRequest']['message'],
'Not conforming tenantName')
# Check bad request: inconsistent tenant
url = reverse('astakos.api.tokens.authenticate')
post_data = """{"auth":{"token":{"id":"%s"},
"tenantName":""}}""" % (
self.user1.auth_token)
r = client.post(url, post_data, content_type='application/json')
self.assertEqual(r.status_code, 200)
# Check successful json response
url = reverse('astakos.api.tokens.authenticate')
post_data = """{"auth":{"passwordCredentials":{"username":"%s",
......
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