Skip to content

Commit

Permalink
Merge pull request #298 from bounswe/backend/feature/refactor-#297
Browse files Browse the repository at this point in the history
[Backend] Code Refactor
  • Loading branch information
mehmetemreakbulut authored Nov 19, 2022
2 parents b67bb31 + 838ef0d commit 3dd5287
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
3 changes: 0 additions & 3 deletions app/backend/authentication/models.py

This file was deleted.

4 changes: 2 additions & 2 deletions app/backend/authentication/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def create(self, validated_data):
class RegistrationSerializer(serializers.ModelSerializer):

email = serializers.EmailField(
required=True,
validators=[UniqueValidator(queryset=User.objects.all())]
required=True,
validators=[UniqueValidator(queryset=User.objects.all())]
)

password = serializers.CharField(write_only=True, required=True, validators=[validate_password])
Expand Down
7 changes: 0 additions & 7 deletions app/backend/backend/utils.py

This file was deleted.

14 changes: 11 additions & 3 deletions app/backend/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@

from tests.constants import *

import django.contrib.auth.hashers

def make_password(password):
assert password
return django.contrib.auth.hashers.make_password(
password=password
)


class AdminTestCase(TestCase):
def createAdmin(self):
models.CustomAdmin.objects.create(
email=TEST_ADMIN_EMAIL,
password=utils.make_password(TEST_PASSWORD),
password=make_password(TEST_PASSWORD),
type=constants.UserType.ADMIN.value,
admin_username=TEST_ADMIN_USERNAME
)
Expand Down Expand Up @@ -48,7 +56,7 @@ def createMember(self, email = None, member_username = None):
)
return models.Member.objects.create(
email=TEST_MEMBER_EMAIL if email == None else email,
password=utils.make_password(TEST_PASSWORD),
password=make_password(TEST_PASSWORD),
type=constants.UserType.MEMBER.value,
member_username=TEST_MEMBER_USERNAME if member_username == None else member_username,
info=member_info
Expand Down Expand Up @@ -102,7 +110,7 @@ class DoctorTestCase(TestCase):
def createDoctor(self):
models.Doctor.objects.create(
email=TEST_DOCTOR_EMAIL,
password=utils.make_password(TEST_PASSWORD),
password=make_password(TEST_PASSWORD),
type=constants.UserType.DOCTOR.value,
full_name=TEST_DOCTOR_FULLNAME,
hospital_name=TEST_DOCTOR_HOSPITAL_NAME,
Expand Down

0 comments on commit 3dd5287

Please sign in to comment.