mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-02-11 23:40:36 +03:00
Update tests and fix register serializer
This commit is contained in:
parent
65b29d3515
commit
52f04ba224
|
@ -146,11 +146,17 @@ class RegisterSerializer(serializers.Serializer):
|
||||||
def custom_signup(self, request, user):
|
def custom_signup(self, request, user):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def get_cleaned_data(self):
|
||||||
|
return {
|
||||||
|
'username': self.validated_data.get('username', ''),
|
||||||
|
'password1': self.validated_data.get('password', ''),
|
||||||
|
'email': self.validated_data.get('email', '')
|
||||||
|
}
|
||||||
|
|
||||||
def save(self, request):
|
def save(self, request):
|
||||||
adapter = get_adapter()
|
adapter = get_adapter()
|
||||||
user = adapter.new_user(request)
|
user = adapter.new_user(request)
|
||||||
self.cleaned_data = self.validated_data
|
self.cleaned_data = self.get_cleaned_data()
|
||||||
self.cleaned_data['password1'] = self.cleaned_data['password']
|
|
||||||
adapter.save_user(request, user, self)
|
adapter.save_user(request, user, self)
|
||||||
self.custom_signup(request, user)
|
self.custom_signup(request, user)
|
||||||
setup_user_email(request, user, [])
|
setup_user_email(request, user, [])
|
||||||
|
|
|
@ -138,8 +138,7 @@ class APITestCase1(TestCase, BaseAPITestCase):
|
||||||
# data without user profile
|
# data without user profile
|
||||||
REGISTRATION_DATA = {
|
REGISTRATION_DATA = {
|
||||||
"username": USERNAME,
|
"username": USERNAME,
|
||||||
"password1": PASS,
|
"password": PASS,
|
||||||
"password2": PASS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTRATION_DATA_WITH_EMAIL = REGISTRATION_DATA.copy()
|
REGISTRATION_DATA_WITH_EMAIL = REGISTRATION_DATA.copy()
|
||||||
|
@ -432,8 +431,7 @@ class TestSocialAuth(TestCase, BaseAPITestCase):
|
||||||
EMAIL = "person1@world.com"
|
EMAIL = "person1@world.com"
|
||||||
REGISTRATION_DATA = {
|
REGISTRATION_DATA = {
|
||||||
"username": USERNAME,
|
"username": USERNAME,
|
||||||
"password1": PASS,
|
"password": PASS,
|
||||||
"password2": PASS,
|
|
||||||
"email": EMAIL
|
"email": EMAIL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user