lsasln
Results
1
issues of
lsasln
章节:第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()...