Beispiel #1
0
    def test_admin_should_update_alert(self):
        PermissionsTestCase.setUpClass()
        alert = AlertFactory()

        response = self.client.patch('%s%s/' % (ENDPOINT_URL, alert.id), data={'remarks': 'hello world', 'is_resolved':True})

        self.assertEqual(response.status_code, 200)
Beispiel #2
0
    def test_unicef_viewer_should_not_update_alert(self):
        PermissionsTestCase.setUpClass()
        AlertFactory()

        self.logout()
        self.log_unicef_viewer_in()

        response = self.client.patch('%s%s/' % (ENDPOINT_URL, 'someId'), data={'id': 'someId', 'remarks': 'hello world'})

        self.assertEqual(response.status_code, 401)
    def test_consignee_should_not_update_alert(self):
        PermissionsTestCase.setUpClass()
        AlertFactory()

        self.logout()
        self.log_consignee_in(ConsigneeFactory())

        response = self.client.patch('%s%s/' % (ENDPOINT_URL, 'someId'),
                                     data={'id': 'someId', 'remarks': 'hello world'})

        self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)
Beispiel #4
0
    def test_admin_should_update_alert(self):
        PermissionsTestCase.setUpClass()
        alert = AlertFactory()

        response = self.client.patch('%s%s/' % (ENDPOINT_URL, alert.id),
                                     data={
                                         'remarks': 'hello world',
                                         'is_resolved': True
                                     })

        self.assertEqual(response.status_code, HTTP_200_OK)
Beispiel #5
0
    def test_unicef_viewer_should_not_update_alert(self):
        PermissionsTestCase.setUpClass()
        AlertFactory()

        self.logout()
        self.log_unicef_viewer_in()

        response = self.client.patch('%s%s/' % (ENDPOINT_URL, 'someId'),
                                     data={
                                         'id': 'someId',
                                         'remarks': 'hello world'
                                     })

        self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)
 def setUpClass(cls):
     PermissionsTestCase.setUpClass()