def test_should_redirect_to_the_app_list(self, get, delete): get.return_value = mock.Mock(status_code=200) delete.return_value = mock.Mock(status_code=200) response = RemoveApp.as_view()(self.request, name="appname") self.assertEqual(302, response.status_code) self.assertIsInstance(response, HttpResponseRedirect) self.assertEqual(reverse('list-app'), response['Location'])
def test_should_redirect_to_the_app_list(self, get, delete): get.return_value = mock.Mock(status_code=200) delete.return_value = mock.Mock(status_code=200) response = RemoveApp.as_view()(self.request, name="appname") self.assertEqual(302, response.status_code) self.assertIsInstance(response, HttpResponseRedirect) self.assertEqual(reverse("list-app"), response["Location"])
def test_should_returns_404_when_app_does_not_exists(self, get, delete): get.return_value = mock.Mock(status_code=200) delete.return_value = mock.Mock(status_code=404, text="app not found") response = RemoveApp.as_view()(self.request, name="appname") self.assertEqual(404, response.status_code) self.assertEqual("app not found", response.content)