[后端-前台]增加用户注销功能,这个并没有做成api,感觉这个做成api可能没什么必要...所以干脆写了地址重定向到首页了,测试通过account.tests.py

This commit is contained in:
esp
2015-08-27 22:26:00 +08:00
parent c64bd9d165
commit f8677f4966
3 changed files with 22 additions and 1 deletions

View File

@@ -369,3 +369,18 @@ class AdminRequiredDecoratorTest(TestCase):
self.client.login(username="test", password="test")
response = self.client.get("/admin_required_test/cbv/1024/")
self.assertEqual(response.content, "1024")
class UserLogoutTest(TestCase):
def setUp(self):
self.client = Client()
user = User.objects.create(username="test")
user.admin_type = 1
user.set_password("1")
user.save()
def logout_success(self):
self.client = Client()
self.client.login(username="test", password="1")
response = self.client.get("/logout/")
self.assertEqual(response.status_code, 302)