Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REST_FRAMEWORK = {
- 'DEFAULT_AUTHENTICATION_CLASSES': (
- 'rest_framework.authentication.BasicAuthentication',
- ),
- 'DEFAULT_PERMISSION_CLASSES': (
- 'rest_framework.permissions.IsAuthenticated',
- )}
- def test_retrieve(self):
- user = UserFactory.create()
- client = APIClient()
- client.login(email=user.email, password=user.password)
- entity = AttributeChoiceFactory.create()
- response = self.get(retrieve=entity.pk)
- self.assertEqual(response.status_code, status.HTTP_200_OK)
- item = json.loads(response.content)
- self.assertEqual(type(item), dict)
- self.assertEqual(item['pk'], entity.pk)
- self.assertItemsEqual(AttributeChoiceSerializer.Meta.fields, item.keys())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement