def expected_data(self, user): expected = { 'name': user.name, 'email': user.email, 'date_joined': iso_8601(user.date_joined), } return expected
def test_serialize(self): user = UserFactory.build() serializer = serializers.ProfileSerializer(user) expected = { 'name': user.name, 'email': user.email, 'date_joined': iso_8601(user.date_joined), } self.assertEqual(serializer.data, expected)
def expected_data(self, user): url = reverse( 'user_management_api:user_detail', kwargs={'pk': user.pk}, ) expected = { 'url': TEST_SERVER + url, 'name': user.name, 'email': user.email, 'date_joined': iso_8601(user.date_joined), } return expected
def expected_data(self, user): url = reverse( 'user_management_api_users:user_detail', kwargs={'pk': user.pk}, ) expected = { 'url': TEST_SERVER + url, 'name': user.name, 'email': user.email, 'date_joined': iso_8601(user.date_joined), } return expected
def test_serialize(self): user = UserFactory.create() request = self.create_request() context = {'request': request} serializer = serializers.UserSerializer(user, context=context) url = reverse( 'user_management_api:user_detail', kwargs={'pk': user.pk}, request=request, ) expected = { 'url': url, 'name': user.name, 'email': user.email, 'date_joined': iso_8601(user.date_joined), } self.assertEqual(serializer.data, expected)
def test_serialize(self): user = UserFactory.create() request = self.create_request() context = {'request': request} serializer = serializers.UserSerializer(user, context=context) url = reverse( 'user_management_api_users:user_detail', kwargs={'pk': user.pk}, request=request, ) expected = { 'url': url, 'name': user.name, 'email': user.email, 'date_joined': iso_8601(user.date_joined), } self.assertEqual(serializer.data, expected)