def test_page_request_is_successful(self, mock_get): mock_page = mock_get.return_value mock_page.pageapplication_set.all.return_value = [] request = self.factory.get('/featured/') response = views.apps_featured(request) eq_(response.status_code, 200) eq_(sorted(response.context_data.keys()), ['application_list', 'object']) mock_get.assert_called_once_with(Page, status=Page.FEATURED) mock_page.pageapplication_set.all.assert_called_once()
def test_page_does_not_exist(self, get_mock): get_mock.side_effect = Http404 request = self.factory.get('/featured/') views.apps_featured(request)