问题描述
我有一个自定义的登录视图,可根据用户是否具有OTP设置将用户重定向到其他页面。
在测试中,我发出了登录视图的发布请求,但得到HttpResponseBadRequest 400
。
如果我提出请求,我将得到正确的200
响应。
class TestLoginRedirect(TestCase):
@classmethod
def setUpTestData(cls):
cls.password='aoisjdoaisjd'
# create a user without OTP
cls.user = CustomUser.objects.create_user(
username='aseem',password=cls.password
)
def test_login(self):
response = self.client.post(
path=reverse('login'),data={
'username': 'aseem','password': self.password
}
)
print(response)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)