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):
|
||||
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):
|
||||
adapter = get_adapter()
|
||||
user = adapter.new_user(request)
|
||||
self.cleaned_data = self.validated_data
|
||||
self.cleaned_data['password1'] = self.cleaned_data['password']
|
||||
self.cleaned_data = self.get_cleaned_data()
|
||||
adapter.save_user(request, user, self)
|
||||
self.custom_signup(request, user)
|
||||
setup_user_email(request, user, [])
|
||||
|
|
|
@ -138,8 +138,7 @@ class APITestCase1(TestCase, BaseAPITestCase):
|
|||
# data without user profile
|
||||
REGISTRATION_DATA = {
|
||||
"username": USERNAME,
|
||||
"password1": PASS,
|
||||
"password2": PASS
|
||||
"password": PASS,
|
||||
}
|
||||
|
||||
REGISTRATION_DATA_WITH_EMAIL = REGISTRATION_DATA.copy()
|
||||
|
@ -432,8 +431,7 @@ class TestSocialAuth(TestCase, BaseAPITestCase):
|
|||
EMAIL = "person1@world.com"
|
||||
REGISTRATION_DATA = {
|
||||
"username": USERNAME,
|
||||
"password1": PASS,
|
||||
"password2": PASS,
|
||||
"password": PASS,
|
||||
"email": EMAIL
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user