How to use session in TestCase in Django?

前端 未结 5 1121
误落风尘
误落风尘 2020-12-10 03:36

I would like to read some session variables from a test (Django TestCase)

How to do that in a clean way ?

def test_add_docs(self):
    \"\"\"
    Tes         


        
5条回答
  •  醉酒成梦
    2020-12-10 04:25

    You should be able to access a Client's session variales through its session property, so I guess self.client.session['documents_to_share_ids'] = [1] should be what you are looking for!

提交回复
热议问题