-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from Cadasta/bugs/user-model
Replace first_name/last_name with full_name
- Loading branch information
Showing
27 changed files
with
133 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,7 @@ def test_valid_data(self): | |
'email': '[email protected]', | ||
'password1': 'iloveyoko79', | ||
'password2': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
form = RegisterForm(data) | ||
form.save() | ||
|
@@ -32,8 +31,7 @@ def test_passwords_do_not_match(self): | |
'email': '[email protected]', | ||
'password1': 'iloveyoko79', | ||
'password2': 'iloveyoko68', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
form = RegisterForm(data) | ||
|
||
|
@@ -48,8 +46,7 @@ def test_signup_with_existing_email(self): | |
'email': '[email protected]', | ||
'password1': 'iloveyoko79', | ||
'password2': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
form = RegisterForm(data) | ||
|
||
|
@@ -66,15 +63,13 @@ def test_update_user(self): | |
data = { | ||
'username': 'imagine71', | ||
'email': '[email protected]', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
form = ProfileForm(data, instance=user) | ||
form.save() | ||
|
||
user.refresh_from_db() | ||
assert user.first_name == 'John' | ||
assert user.last_name == 'Lennon' | ||
assert user.full_name == 'John Lennon' | ||
|
||
def test_update_user_with_existing_username(self): | ||
UserFactory.create(username='existing') | ||
|
@@ -83,8 +78,7 @@ def test_update_user_with_existing_username(self): | |
data = { | ||
'username': 'existing', | ||
'email': '[email protected]', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
form = ProfileForm(data, instance=user) | ||
assert form.is_valid() is False | ||
|
@@ -96,8 +90,7 @@ def test_update_user_with_existing_email(self): | |
data = { | ||
'username': 'imagine71', | ||
'email': '[email protected]', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
form = ProfileForm(data, instance=user) | ||
assert form.is_valid() is False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,7 @@ | |
'username': 'imagine71', | ||
'email': '[email protected]', | ||
'password': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
|
||
|
||
|
@@ -49,8 +48,7 @@ def test_create_without_email(self): | |
'username': 'imagine71', | ||
'password': 'iloveyoko79', | ||
'password_repeat': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
|
||
serializer = RegistrationSerializer(data=data) | ||
|
@@ -67,8 +65,7 @@ def test_create_with_existing_email(self): | |
'email': '[email protected]', | ||
'password': 'iloveyoko79', | ||
'password_repeat': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
|
||
serializer = RegistrationSerializer(data=data) | ||
|
@@ -89,8 +86,7 @@ def test_create_with_valid_data(self): | |
'username': 'imagine71', | ||
'email': '[email protected]', | ||
'password': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
'last_login': '2016-01-01 23:00:00' | ||
} | ||
serializer = UserSerializer(data=data) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,8 +84,7 @@ def test_user_signs_up(self): | |
'username': 'imagine71', | ||
'email': '[email protected]', | ||
'password': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
self._post(data, status=201, count=1) | ||
|
||
|
@@ -95,8 +94,7 @@ def test_user_signs_up_with_invalid(self): | |
data = { | ||
'username': 'imagine71', | ||
'password': 'iloveyoko79', | ||
'first_name': 'John', | ||
'last_name': 'Lennon', | ||
'full_name': 'John Lennon', | ||
} | ||
self._post(data, status=400, count=0) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import os.path | ||
import factory | ||
from faker import Factory | ||
from django.contrib.gis.geos import GEOSGeometry | ||
from django.conf import settings | ||
|
@@ -20,20 +19,18 @@ def add_test_users(self): | |
# the first two named users will have superuser access | ||
named_users = [ | ||
{'username': 'iross', 'email': '[email protected]', | ||
'first_name': 'Ian', 'last_name': 'Ross'}, | ||
'full_name': 'Ian Ross'}, | ||
{'username': 'oroick', 'email': '[email protected]', | ||
'first_name': 'Oliver', 'last_name': 'Roick'}] | ||
'full_name': 'Oliver Roick'}] | ||
# add user's with names in languages that need to be tested. | ||
languages = ['el_GR', 'ja_JP', 'hi_IN', 'hr_HR', 'lt_LT'] | ||
named_users.append({ | ||
'first_name': 'עזרא', | ||
'last_name': 'ברש' | ||
'full_name': 'עזרא ברש' | ||
}) | ||
for lang in languages: | ||
fake = Factory.create(lang) | ||
named_users.append({ | ||
'first_name': fake.first_name(), | ||
'last_name': fake.last_name() | ||
'full_name': fake.name() | ||
}) | ||
for n in range(20): | ||
if n < len(named_users): | ||
|
@@ -48,8 +45,7 @@ def add_test_users(self): | |
users.append(UserFactory.create( | ||
password='password', | ||
is_active=(n < 8), | ||
first_name=factory.Faker('first_name'), | ||
last_name=factory.Faker('last_name'), | ||
full_name=fake.name(), | ||
)) | ||
print('Successfully added test users.') | ||
return users | ||
|
Oops, something went wrong.