Revision 8aaf4f0d
b/snf-astakos-app/astakos/im/tests/api.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from astakos.im.tests.common import * |
35 |
from astakos.im.settings import astakos_services, BASE_HOST |
|
36 |
from synnefo.lib.services import get_service_path |
|
37 |
from synnefo.lib import join_urls |
|
35 | 38 |
|
36 | 39 |
from django.test import TestCase |
37 | 40 |
from django.core.urlresolvers import reverse |
... | ... | |
590 | 593 |
# body = minidom.parseString(r.content) |
591 | 594 |
# except Exception, e: |
592 | 595 |
# self.fail(e) |
596 |
|
|
597 |
|
|
598 |
class WrongPathAPITest(TestCase): |
|
599 |
def test_catch_wrong_api_paths(self, *args): |
|
600 |
path = get_service_path(astakos_services, 'account', 'v1.0') |
|
601 |
path = join_urls(BASE_HOST, path, 'nonexistent') |
|
602 |
response = self.client.get(path) |
|
603 |
self.assertEqual(response.status_code, 400) |
|
604 |
try: |
|
605 |
error = json.loads(response.content) |
|
606 |
except ValueError: |
|
607 |
self.assertTrue(False) |
|
608 |
|
|
609 |
def test_catch_wrong_api_paths(self, *args): |
|
610 |
path = get_service_path(astakos_services, 'identity', 'v2.0') |
|
611 |
path = join_urls(BASE_HOST, path, 'nonexistent') |
|
612 |
response = self.client.get(path) |
|
613 |
self.assertEqual(response.status_code, 400) |
|
614 |
try: |
|
615 |
error = json.loads(response.content) |
|
616 |
except ValueError: |
|
617 |
self.assertTrue(False) |
Also available in: Unified diff