Revision 2377e7c2 snf-astakos-client/astakosclient/tests.py
b/snf-astakos-client/astakosclient/tests.py | ||
---|---|---|
47 | 47 |
import astakosclient |
48 | 48 |
from astakosclient import AstakosClient |
49 | 49 |
from astakosclient.errors import \ |
50 |
AstakosClientException, Unauthorized, BadRequest, NotFound |
|
50 |
AstakosClientException, Unauthorized, BadRequest, NotFound, \ |
|
51 |
NoDisplayName, NoUUID |
|
51 | 52 |
|
52 | 53 |
# Use backported unittest functionality if Python < 2.7 |
53 | 54 |
try: |
... | ... | |
575 | 576 |
self.fail("Shouldn't raise an Exception") |
576 | 577 |
self.assertEqual(info, user_1['username']) |
577 | 578 |
|
579 |
# ---------------------------------- |
|
580 |
# Get info with wrong uuid |
|
581 |
def test_NoDisplayName(self): |
|
582 |
global token_1 |
|
583 |
_mockRequest([_requestOk]) |
|
584 |
try: |
|
585 |
client = AstakosClient("https://example.com") |
|
586 |
client.getDisplayName(token_1, "1234") |
|
587 |
except NoDisplayName: |
|
588 |
pass |
|
589 |
except: |
|
590 |
self.fail("Should have raised NoDisplayName exception") |
|
591 |
else: |
|
592 |
self.fail("Should have raised NoDisplayName exception") |
|
593 |
|
|
578 | 594 |
|
579 | 595 |
class TestGetUUIDs(unittest.TestCase): |
580 | 596 |
"""Test cases for functions getUUIDs/getUUID""" |
... | ... | |
624 | 640 |
self.fail("Shouldn't raise an Exception") |
625 | 641 |
self.assertEqual(info, user_1['uuid']) |
626 | 642 |
|
643 |
# ---------------------------------- |
|
644 |
# Get uuid with wrong username |
|
645 |
def test_NoUUID(self): |
|
646 |
global token_1 |
|
647 |
_mockRequest([_requestOk]) |
|
648 |
try: |
|
649 |
client = AstakosClient("https://example.com") |
|
650 |
client.getUUID(token_1, "1234") |
|
651 |
except NoUUID: |
|
652 |
pass |
|
653 |
except: |
|
654 |
self.fail("Should have raised NoUUID exception") |
|
655 |
else: |
|
656 |
self.fail("Should have raised NoUUID exception") |
|
657 |
|
|
627 | 658 |
|
628 | 659 |
# ---------------------------- |
629 | 660 |
# Run tests |
Also available in: Unified diff