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