Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我唯一能找到的是如何在测试期间设置会话。我想要检查视图是否将会话设置为特定值。
这就是我想象的应该是这样的:
c = Client() response = c.post('/whatever/') self.assertEqual('wanted value', response.session['my_value'])
所以cookie可用,但不可用session。这不可能这么难。
cookie
session
Client 有一个session属性,如文档中所示。