def test_post_authenticated(self): self.login_user(UserFactory.create()) response = self._post(url=self.url, data=self.data) # import pdb; pdb.set_trace() self.assertEquals(response.status_code, 302) suggestions = Resource.objects.all() self.assertEqual(1, suggestions.count())
def test_get_authenticated(self): """Authenticated users can view add suggestion page.""" self.login_user(UserFactory.create()) response = self._get(url=self.url) self.assertEquals(response.status_code, 200) self.assertTemplateUsed(response, self.template_name) self.failUnless('form' in response.context)
def test_get_authenticated(self): """Authenticated users can view add resource page.""" self.login_user(UserFactory.create()) response = self._get(url=self.url) self.assertEquals(response.status_code, 200) self.assertTemplateUsed(response, self.template_name) self.failUnless('form' in response.context)
def test_post_authenticated(self): """Authenticated users can add suggestions.""" data = self.get_valid_data() self.login_user(UserFactory.create()) response = self._post(url=self.url, data=data) self.assertEquals(response.status_code, 302) suggestions = Request.objects.all() self.assertEqual(1, suggestions.count())
def setUp(self): self.user = UserFactory.create() self.data = self.get_valid_data() self.url = reverse(self.url_name)