-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into clean_settings2
- Loading branch information
Showing
11 changed files
with
292 additions
and
821 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
coverage: | ||
coverage: # https://docs.codecov.com/docs/codecov-yaml | ||
precision: 2 | ||
round: down | ||
range: 90...90 | ||
status: | ||
patch: | ||
default: | ||
target: 90% | ||
threshold: 1% | ||
status: # https://docs.codecov.com/docs/commit-status | ||
project: | ||
default: | ||
target: 90% | ||
threshold: 1% | ||
threshold: 0% | ||
|
||
comment: 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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
© Ocado Group | ||
Created on 18/04/2024 at 17:26:59(+01:00). | ||
""" | ||
|
||
from ...tests import ModelSerializerTestCase | ||
from ..models import IndependentUser, StudentUser, TeacherUser, User | ||
from .user import UserSerializer | ||
|
||
|
||
# pylint: disable-next=missing-class-docstring | ||
class TestUserSerializer(ModelSerializerTestCase[User, User]): | ||
model_serializer_class = UserSerializer | ||
|
||
# test: to representation | ||
|
||
def test_to_representation__teacher(self): | ||
"""Serialize teacher user to representation.""" | ||
user = TeacherUser.objects.first() | ||
assert user | ||
|
||
self.assert_to_representation( | ||
user, | ||
new_data={ | ||
"teacher": { | ||
"id": user.teacher.id, | ||
"school": user.teacher.school.id, | ||
"is_admin": user.teacher.is_admin, | ||
}, | ||
"student": None, | ||
}, | ||
) | ||
|
||
def test_to_representation__student(self): | ||
"""Serialize student user to representation.""" | ||
user = StudentUser.objects.first() | ||
assert user | ||
|
||
self.assert_to_representation( | ||
user, | ||
new_data={ | ||
"teacher": None, | ||
"student": { | ||
"id": user.student.id, | ||
"klass": user.student.class_field.access_code, | ||
"school": user.student.class_field.teacher.school.id, | ||
}, | ||
}, | ||
) | ||
|
||
def test_to_representation__indy(self): | ||
"""Serialize independent user to representation.""" | ||
user = IndependentUser.objects.first() | ||
assert user | ||
|
||
self.assert_to_representation( | ||
user, | ||
new_data={"teacher": None, "student": None}, | ||
) |
Oops, something went wrong.