예제 #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)
예제 #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)
예제 #3
0
    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)
예제 #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)
예제 #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)
예제 #6
0
 def setUpClass(cls):
     PermissionsTestCase.setUpClass()