Advertisement
Guest User

Untitled

a guest
Jan 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. REST_FRAMEWORK = {
  2. 'DEFAULT_AUTHENTICATION_CLASSES': (
  3. 'rest_framework.authentication.BasicAuthentication',
  4. ),
  5. 'DEFAULT_PERMISSION_CLASSES': (
  6. 'rest_framework.permissions.IsAuthenticated',
  7. )}
  8.  
  9. def test_retrieve(self):
  10. user = UserFactory.create()
  11. client = APIClient()
  12. client.login(email=user.email, password=user.password)
  13. entity = AttributeChoiceFactory.create()
  14. response = self.get(retrieve=entity.pk)
  15. self.assertEqual(response.status_code, status.HTTP_200_OK)
  16. item = json.loads(response.content)
  17. self.assertEqual(type(item), dict)
  18. self.assertEqual(item['pk'], entity.pk)
  19. self.assertItemsEqual(AttributeChoiceSerializer.Meta.fields, item.keys())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement