Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
a04e5fd0
Commit
a04e5fd0
authored
Jun 12, 2013
by
Sofia Papagiannaki
Browse files
astakos: allow empty tenantName in POST /tokens
parent
74be46f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/api/tokens.py
View file @
a04e5fd0
...
...
@@ -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'
)
...
...
snf-astakos-app/astakos/im/tests/api.py
View file @
a04e5fd0
...
...
@@ -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",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment