class DjangoAnyClient(TestCase): urls = 'django_any.tests.test_client' def setUp(self): self.client = Client() def test_login_as_super_user(self): # TODO make test page which will not require is_staff like /admin self.assertTrue(self.client.login_as(is_superuser=True, is_staff=True)) response = self.client.get('/admin/') self.assertEquals(200, response.status_code) def test_login_as_custom_user(self): user = User.objects.create_user('john', '*****@*****.**', 'johnpassword') self.assertTrue(self.client.login_as(user=user)) def test_login_as_failed(self): user = None self.assertRaises(AssertionError, self.client.login_as, user=user) def test_post_any_data(self): response = self.client.post_any_data('/view/') self.assertRedirects(response, '/view/')
class DjangoAnyClient(TestCase): urls = 'django_any.tests.test_client' def setUp(self): self.client = Client() def test_login_as_super_user(self): self.assertTrue(self.client.login_as(is_superuser=True)) response = self.client.get('/admin/') self.assertEquals(200, response.status_code) def test_post_any_data(self): response = self.client.post_any_data('/view/') self.assertRedirects(response, '/view/')
class DjangoAnyClient(TestCase): def setUp(self): self.client = Client() def test_login_as_super_user(self): # TODO make test page which will not require is_staff like /admin self.assertTrue(self.client.login_as(is_superuser=True, is_staff=True)) response = self.client.get('/admin/') self.assertEqual(200, response.status_code) def test_login_as_custom_user(self): user = User.objects.create_user('john', '*****@*****.**', 'johnpassword') self.assertTrue(self.client.login_as(user=user)) def test_login_as_failed(self): user = None self.assertRaises(AssertionError, self.client.login_as, user=user) def test_post_any_data(self): response = self.client.post_any_data('/view/') self.assertRedirects(response, '/view/')
class DjangoAnyClient(TestCase): urls = 'django_any.tests.test_client' def setUp(self): self.client = Client() def test_login_as_super_user(self): self.assertTrue(self.client.login_as(is_superuser=True)) response = self.client.get('/admin/') self.assertEquals(200, response.status_code) def test_login_as_custom_user(self): user = User.objects.create_user('john', '*****@*****.**', 'johnpassword') self.assertTrue(self.client.login_as(user=user)) def test_login_as_failed(self): user = None self.assertRaises(AssertionError, self.client.login_as, user=user) def test_post_any_data(self): response = self.client.post_any_data('/view/') self.assertRedirects(response, '/view/')