tests.test_notifications   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestNotifications.test_get_delete_notifications() 0 25 2
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
32
        # TODO: add more tests if WebDAV api will be implemented and there will be ability to make actions
33
        #  using api which creates notifications (mentions in comments)
34
        #  or when Federated file sharings api will be implemented (harder way)
35