jabajke

Untitled

Feb 14th, 2023 (edited)
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. @pytest.fixture
  2. def correct_user_fixture(self):
  3. user = User.objects.create_user(**self.payload)
  4. user.is_active = True
  5. user.save()
  6. return user
  7.  
  8. @pytest.mark.django_db
  9. def test_user_logout(self, correct_user_fixture):
  10. refresh = RefreshToken.for_user(correct_user_fixture)
  11. response = client.post(
  12. reverse('logout'),
  13. dict(refresh=refresh),
  14. HTTP_AUTHORIZATION=f'Bearer {refresh.access_token}')
  15. assert response.status_code == 204
  16.  
  17.  
  18. /usr/local/lib/python3.10/site-packages/rest_framework/test.py:296: in post
  19. response = super().post(
  20. /usr/local/lib/python3.10/site-packages/rest_framework/test.py:209: in post
  21. data, content_type = self._encode_data(data, format, content_type)
  22. /usr/local/lib/python3.10/site-packages/rest_framework/test.py:180: in _encode_data
  23. ret = renderer.render(data)
  24. /usr/local/lib/python3.10/site-packages/rest_framework/renderers.py:914: in render
  25. return encode_multipart(self.BOUNDARY, data)
  26. /usr/local/lib/python3.10/site-packages/django/test/client.py:254: in encode_multipart
  27. for item in value:
  28. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  29.  
  30. self = {'token_type': 'refresh', 'exp': 1676462476, 'jti': 'bbd8a05dc61a4d0f9dd8a916a4156af1', 'user_id': 4}, key = 0
  31.  
  32. def __getitem__(self, key):
  33. > return self.payload[key]
  34. E KeyError: 0
  35.  
Advertisement
Add Comment
Please, Sign In to add comment