def test_options_post(self): """ Try to view options as anonymous. """ self.test_options_user() self.client.login(username=self.username, password=self.password) response = self.client.post( reverse('planet:options'), { 'number_initially_displayed': "11", 'max_entries_saved': "101", 'number_additionally_displayed': "9", 'submit': "Submit", }, ) self.assertEquals(response.status_code, 302) self.assertNumQueries(1) request = self.factory.get(reverse('planet:options'), { 'number_initially_displayed': "11", }) request.user = self.user response = OptionsView.as_view()(request) self.assertEquals(response.status_code, 200) self.assertNumQueries(1) """ .. todo:: This should actually be '11', after we updated the value above. """ options = Options.objects.get(user=self.user) self.assertEqual(options.user, self.user)
def test_options_user(self): """ Try to view options as anonymous. """ request = self.factory.get(reverse('planet:options')) request.user = self.user response = OptionsView.as_view()(request) self.assertEquals(response.status_code, 200)
def test_options_post(self): """ Try to view options as anonymous. """ self.test_options_user() self.client.login(username=self.username, password=self.password) response = self.client.post( reverse('planet:options'), { 'number_initially_displayed': "11", 'max_entries_saved': "101", 'number_additionally_displayed': "9", 'submit': "Submit", }, ) self.assertEquals(response.status_code, 302) self.assertNumQueries(1) request = self.factory.get( reverse('planet:options'), { 'number_initially_displayed': "11", } ) request.user = self.user response = OptionsView.as_view()(request) self.assertEquals(response.status_code, 200) self.assertNumQueries(1) """ .. todo:: This should actually be '11', after we updated the value above. """ options = Options.objects.get(user=self.user) self.assertEqual(options.user, self.user)