Django: test failing on a view with @login_required

后端 未结 3 1875
梦谈多话
梦谈多话 2020-12-13 20:56

I\'m trying to build a test for a view that\'s decorated with @login_required, since I failed to make it work, I did a simple test and still can\'t make it pass.

Her

3条回答
  •  执笔经年
    2020-12-13 21:35

    Here is the answer:

    Python 2.6.5 made a change to the way cookies are stored which is subtly incompatible with the test client. This problem has been fixed in the 1.1.X and trunk branches, but the fix hasn't yet made it into a formal release.

    If you are using 1.1.X and Python 2.6.5, you're going to have problems with any test activity involving cookies. You either need to downgrade Python, or use the 1.1.X branch rather than the 1.1.1 release.

    A 1.1.2 release (that will include the fix for the problem you describe) will be made at the same time that we release 1.2 - hopefully, very very soon.

    Yours, Russ Magee %-)

    http://groups.google.com/group/django-users/browse_frm/thread/617457f5d62366ae/05f0c01fff0b9e6d?hl=en&lnk=gst&q=2.6.5#05f0c01fff0b9e6d

提交回复
热议问题