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)
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)
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)
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)
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)
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)