| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from .base import BaseTestCase |
||
| 2 | |||
| 3 | |||
| 4 | class TestNotifications(BaseTestCase): |
||
| 5 | |||
| 6 | def test_get_delete_notifications(self): |
||
| 7 | # get all notifications |
||
| 8 | res = self.nxc.get_notifications() |
||
| 9 | all_data = res.data |
||
| 10 | assert res.is_ok |
||
| 11 | |||
| 12 | if len(all_data): |
||
| 13 | notification = all_data[0] |
||
| 14 | |||
| 15 | # get single notification |
||
| 16 | res = self.nxc.get_notification(notification['notification_id']) |
||
| 17 | assert res.is_ok |
||
| 18 | assert res.data['notification_id'] == notification['notification_id'] |
||
| 19 | |||
| 20 | # delete single notification |
||
| 21 | res = self.nxc.delete_notification(notification['notification_id']) |
||
| 22 | assert res.is_ok |
||
| 23 | else: |
||
| 24 | # assert get single notification will return 404 not found |
||
| 25 | res = self.nxc.get_notification(1) |
||
| 26 | assert res.status_code == self.NOT_FOUND_CODE |
||
| 27 | |||
| 28 | # delete all notifications success code check |
||
| 29 | res = self.nxc.delete_all_notifications() |
||
| 30 | assert res.is_ok |
||
| 31 | |||
| 35 |