Exemplo n.º 1
0
 def test_post_auth(self):
     auth_util.login_test_user(self.client)
     url = app_name + ':' + self.model_name + '-create'
     response = self.client.post(reverse(url),
                                 auth_util.post_data[self.model_name])
     self.client.logout()
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
Exemplo n.º 2
0
 def test_delete_cross_user(self):
     auth_util.login_test_user(self.client, index=0)
     response = self.client.delete(self.detail_url2)
     self.client.logout()
     self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
Exemplo n.º 3
0
 def test_put_cross_user(self):
     auth_util.login_test_user(self.client, index=0)
     response = self.client.put(self.detail_url2,
                                auth_util.post_data[auth_util.USER_NAME])
     self.client.logout()
     self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
Exemplo n.º 4
0
 def test_delete_auth(self):
     auth_util.login_test_user(self.client)
     response = self.client.delete(self.detail_url)
     self.client.logout()
     self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
Exemplo n.º 5
0
 def test_put_auth(self):
     auth_util.login_test_user(self.client)
     response = self.client.put(self.detail_url,
                                auth_util.post_data[auth_util.USER_NAME])
     self.client.logout()
     self.assertEqual(response.status_code, status.HTTP_200_OK)
Exemplo n.º 6
0
 def test_detail_auth(self):
     auth_util.login_test_user(self.client)
     response = self.client.get(self.detail_url)
     self.client.logout()
     self.assertEqual(response.status_code, status.HTTP_200_OK)