def test_containers_doesnt_allow_anonymous(self): response = containers(self.request_get, settings.TEST_CONTAINER) self.assertEqual(response.status_code, 302) self.assertTrue(isinstance(response, HttpResponseRedirect)) self.assertEqual(response.url, '/') response = containers(self.request_post, settings.TEST_CONTAINER) self.assertEqual(response.status_code, 302) self.assertTrue(isinstance(response, HttpResponseRedirect)) self.assertEqual(response.url, '/')
def test_containers_handles_logged_in_user(self): self.request_get.session = { 'username': settings.TEST_USER, 'password': settings.TEST_PASSWORD, 'api_url': settings.DEFAULT_API_URL} response = containers(self.request_get, settings.TEST_CONTAINER) self.request_get.session = {} self.assertEqual(response.status_code, 200) self.assertContains(response, '({id})</b>'.format(id=settings.TEST_CONTAINER))