Revision 49005665 snf-astakos-app/astakos/im/tests/api.py
b/snf-astakos-app/astakos/im/tests/api.py | ||
---|---|---|
464 | 464 |
post_data = """{"auth":{"passwordCredentials":{"username":"%s", |
465 | 465 |
"password":"%s"}, |
466 | 466 |
"tenantName":"%s"}}""" % ( |
467 |
self.user1.uuid, self.user2.auth_token, self.user1.uuid)
|
|
467 |
self.user1.uuid, self.user2.auth_token, self.user2.uuid)
|
|
468 | 468 |
r = client.post(url, post_data, content_type='application/json') |
469 | 469 |
self.assertEqual(r.status_code, 401) |
470 | 470 |
body = json.loads(r.content) |
471 | 471 |
self.assertEqual(body['unauthorized']['message'], |
472 | 472 |
'Invalid credentials') |
473 | 473 |
|
474 |
# Check inconsistent tenant |
|
475 |
url = '/astakos/api/tokens' |
|
476 |
post_data = """{"auth":{"passwordCredentials":{"username":"%s", |
|
477 |
"password":"%s"}, |
|
478 |
"tenantName":"%s"}}""" % ( |
|
479 |
self.user1.uuid, self.user1.auth_token, self.user2.uuid) |
|
480 |
r = client.post(url, post_data, content_type='application/json') |
|
481 |
self.assertEqual(r.status_code, 401) |
|
482 |
body = json.loads(r.content) |
|
483 |
self.assertEqual(body['unauthorized']['message'], |
|
484 |
'Invalid tenant') |
|
485 |
|
|
474 | 486 |
# Check invalid json data |
475 | 487 |
url = '/astakos/api/tokens' |
476 | 488 |
r = client.post(url, "not json", content_type='application/json') |
... | ... | |
527 | 539 |
**headers) |
528 | 540 |
self.assertEqual(r.status_code, 200) |
529 | 541 |
self.assertTrue(r['Content-Type'].startswith('application/xml')) |
530 |
try: |
|
531 |
body = minidom.parseString(r.content) |
|
532 |
except Exception, e: |
|
533 |
self.fail(e) |
|
542 |
# try:
|
|
543 |
# body = minidom.parseString(r.content)
|
|
544 |
# except Exception, e:
|
|
545 |
# self.fail(e)
|
|
534 | 546 |
|
535 | 547 |
def test_get_endpoints(self): |
536 | 548 |
client = Client() |
Also available in: Unified diff