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

[Backend] Code Refactor #298

Merged
merged 1 commit into from
Nov 19, 2022
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
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