We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
章节:第9章 位置:test_watchlist.py:测试认证相关功能
class WatchlistTestCase(unittest.TestCase): # ... # 测试登录保护 def test_login_protect(self): response = self.client.get('/') data = response.get_data(as_text=True) self.assertNotIn('Logout', data) ......
这个测试用例不会通过,原因猜测可能是存在登录的缓存,我看了返回的html是登录过后的。于是我在前面加了个logout的方法,并且在这段代码前使用,即可通过测试:
def logout(self): self.client.get('/logout') ...... def test_login_protect(self): self.logout() response = self.client.get('/') data = response.get_data(as_text=True) self.assertNotIn('Logout', data) self.assertNotIn('Settings', data) self.assertNotIn('<form method="post">', data) self.assertNotIn('Delete', data) self.assertNotIn('Edit', data)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
章节:第9章
位置:test_watchlist.py:测试认证相关功能
这个测试用例不会通过,原因猜测可能是存在登录的缓存,我看了返回的html是登录过后的。于是我在前面加了个logout的方法,并且在这段代码前使用,即可通过测试:
The text was updated successfully, but these errors were encountered: