Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix signup serializer #1

Merged
merged 1 commit into from
Dec 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/accounts/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class UserRegistrationSerializer(serializers.ModelSerializer):

class Meta:
model = User
fields = ('name', 'email', 'password', 'confirm_password', 'app_version', 'branch_data')
fields = ('name', 'email', 'password', 'confirm_password', 'app_version', 'branch_data', 'facebook_uid')

def create(self, validated_data):
"""
Expand Down
23 changes: 15 additions & 8 deletions tests/v1/python/accounts/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class UserRegistrationSerializerTest(CustomTestCase, APITestCase):
{'data': {'email': '[email protected]',
'name': 'John Doe',
'password': 'test',
'confirm_password': 'test'},
'confirm_password': 'test',
'facebook_uid': 'randomfacebookuid'},
'error': ('email', ['Please use a different email address provider.']),
'label': 'Invalid email.',
'method': 'POST',
Expand All @@ -198,7 +199,8 @@ class UserRegistrationSerializerTest(CustomTestCase, APITestCase):
{'data': {'email': 'test1@gmail',
'name': 'John Doe',
'password': 'test',
'confirm_password': 'test'},
'confirm_password': 'test',
'facebook_uid': 'randomfacebookuid'},
'error': ('email', ['Enter a valid email address.']),
'label': 'Bad email format.',
'method': 'POST',
Expand All @@ -208,7 +210,8 @@ class UserRegistrationSerializerTest(CustomTestCase, APITestCase):
'name': 'John Doe',
'password': 'test',
'confirm_password': 'test',
'app_version': '2.0.0'},
'app_version': '2.0.0',
'facebook_uid': 'randomfacebookuid'},
'error': ('app_version', ['App version not valid.']),
'label': 'App version not valid.',
'method': 'POST',
Expand All @@ -218,7 +221,8 @@ class UserRegistrationSerializerTest(CustomTestCase, APITestCase):
'name': 'John Doe',
'password': 'test',
'confirm_password': 'test',
'app_version': '2.0'},
'app_version': '2.0',
'facebook_uid': 'randomfacebookuid'},
'error': ('email', ['Email already in use, please use a different email address.']),
'label': 'User with email already exists.',
'method': 'POST',
Expand All @@ -228,7 +232,8 @@ class UserRegistrationSerializerTest(CustomTestCase, APITestCase):
'name': 'John Doe',
'password': 'test',
'confirm_password': 'test2',
'app_version': '2.0'},
'app_version': '2.0',
'facebook_uid': 'randomfacebookuid'},
'error': ('non_field_errors', ['Passwords don\'t match.']),
'label': 'Password and confirm password don\'t match.',
'method': 'POST',
Expand All @@ -239,16 +244,18 @@ class UserRegistrationSerializerTest(CustomTestCase, APITestCase):
{'email': '[email protected]',
'name': 'John Doe',
'password': 'test',
'confirm_password': 'test'},
'confirm_password': 'test',
'facebook_uid': 'randomfacebookuid_1'},
{'email': '[email protected]',
'name': 'John Doe',
'app_version': '1.0',
'password': 'test',
'confirm_password': 'test'},
'confirm_password': 'test',
'facebook_uid': 'randomfacebookuid_2'},
]

def setUp(self):
self.required_fields = ['email', 'name', 'password', 'confirm_password']
self.required_fields = ['email', 'name', 'password', 'confirm_password', 'facebook_uid']
self.not_required_fields = ['app_version', 'branch_data']
self.user = UserFactory(email='[email protected]')

Expand Down