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
c7af1b36
Commit
c7af1b36
authored
Jun 12, 2013
by
Georgios D. Tsoukalas
Browse files
astakos: test 400 on wrong astakos API paths
parent
a04e5fd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/tests/api.py
View file @
c7af1b36
...
...
@@ -32,6 +32,9 @@
# or implied, of GRNET S.A.
from
astakos.im.tests.common
import
*
from
astakos.im.settings
import
astakos_services
,
BASE_HOST
from
synnefo.lib.services
import
get_service_path
from
synnefo.lib
import
join_urls
from
django.test
import
TestCase
from
django.core.urlresolvers
import
reverse
...
...
@@ -590,3 +593,25 @@ class TokensApiTest(TestCase):
# body = minidom.parseString(r.content)
# except Exception, e:
# self.fail(e)
class
WrongPathAPITest
(
TestCase
):
def
test_catch_wrong_api_paths
(
self
,
*
args
):
path
=
get_service_path
(
astakos_services
,
'account'
,
'v1.0'
)
path
=
join_urls
(
BASE_HOST
,
path
,
'nonexistent'
)
response
=
self
.
client
.
get
(
path
)
self
.
assertEqual
(
response
.
status_code
,
400
)
try
:
error
=
json
.
loads
(
response
.
content
)
except
ValueError
:
self
.
assertTrue
(
False
)
def
test_catch_wrong_api_paths
(
self
,
*
args
):
path
=
get_service_path
(
astakos_services
,
'identity'
,
'v2.0'
)
path
=
join_urls
(
BASE_HOST
,
path
,
'nonexistent'
)
response
=
self
.
client
.
get
(
path
)
self
.
assertEqual
(
response
.
status_code
,
400
)
try
:
error
=
json
.
loads
(
response
.
content
)
except
ValueError
:
self
.
assertTrue
(
False
)
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