没有登录的时候自动跳转到登录页面,修改相关测试

This commit is contained in:
virusdefender
2015-08-23 20:45:02 +08:00
parent b590ee8577
commit f682aa1fb3
4 changed files with 10 additions and 8 deletions

View File

@@ -260,7 +260,7 @@ class LoginRequiredDecoratorTest(TestCase):
def test_fbv_without_args(self):
# 没登陆
response = self.client.get("/login_required_test/fbv/1/")
self.assertTemplateUsed(response, "utils/error.html")
self.assertRedirects(response, "/login/")
# 登陆后
self.client.login(username="test", password="test")
@@ -270,7 +270,7 @@ class LoginRequiredDecoratorTest(TestCase):
def test_fbv_with_args(self):
# 没登陆
response = self.client.get("/login_required_test/fbv/1024/")
self.assertTemplateUsed(response, "utils/error.html")
self.assertRedirects(response, "/login/")
# 登陆后
self.client.login(username="test", password="test")
@@ -353,7 +353,7 @@ class AdminRequiredDecoratorTest(TestCase):
def test_cbv_without_args(self):
# 没登陆
response = self.client.get("/admin_required_test/cbv/1/")
self.assertTemplateUsed(response, "utils/error.html")
self.assertRedirects(response, "/login/")
# 登陆后
self.client.login(username="test", password="test")