示例#1
0
    def test_logout_redirects_anonymous(self):
        response = tags(self.request_post)
        self.assertEqual(response.status_code, 302)
        self.assertTrue(isinstance(response, HttpResponseRedirect))
        self.assertEqual(response.url, '/')

        response = tags(self.request_post)
        self.assertEqual(response.status_code, 302)
        self.assertTrue(isinstance(response, HttpResponseRedirect))
        self.assertEqual(response.url, '/')
示例#2
0
    def test_tags_doesnt_allow_anonymous(self):
        response = tags(self.request_get)
        self.assertEqual(response.status_code, 302)
        self.assertTrue(isinstance(response, HttpResponseRedirect))
        self.assertEqual(response.url, '/')

        response = tags(self.request_post)
        self.assertEqual(response.status_code, 302)
        self.assertTrue(isinstance(response, HttpResponseRedirect))
        self.assertEqual(response.url, '/')
示例#3
0
 def test_tags_handles_logged_in_user(self):
     self.request_get.session = {
         'username': settings.TEST_USER,
         'password': settings.TEST_PASSWORD,
         'api_url': settings.DEFAULT_API_URL}
     response = tags(self.request_get)
     self.request_get.session = {}
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, TagForm())