Example #1
0
    def test_tag_doesnt_allow_anonymous(self):
        response = tag(self.request_get, settings.TEST_TAG)
        self.assertEqual(response.status_code, 302)
        self.assertTrue(isinstance(response, HttpResponseRedirect))
        self.assertEqual(response.url, '/')

        response = tag(self.request_post, settings.TEST_TAG)
        self.assertEqual(response.status_code, 302)
        self.assertTrue(isinstance(response, HttpResponseRedirect))
        self.assertEqual(response.url, '/')
Example #2
0
 def test_tag_handles_logged_in_user(self):
     self.request_get.session = {
         'username': settings.TEST_USER,
         'password': settings.TEST_PASSWORD,
         'api_url': settings.DEFAULT_API_URL}
     response = tag(self.request_get, settings.TEST_TAG)
     self.request_get.session = {}
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, '<h3><b>{tag}</b> Tag</h3>'.format(tag=settings.TEST_TAG))