tests.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:drf-simple-auth 作者: nickromano 项目源码 文件源码
def test_user_cant_login_with_invalid_username(self):
        get_user_model().objects.create_user('test', email='test', password='test')

        client = APIClient()

        response = client.post(reverse('auth-login'), {'username': 'invalid', 'password': 'test'})
        self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)

        data = json.loads(response.content.decode('utf-8'))
        self.assertEqual(data, {u'detail': u'Invalid email or password.  Please try logging in again.'})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号