-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: add test coverage * use xml * rename codecov yaml * add yml path * ignore codeforlife test helpers * reset pipeline * reset pipeline * use updated workflow * polish_test * add todo * Merge branch 'main' into polish_tests * fix: test job * use new test workflow * add some small tests and don't cover some lines * no cov when debugging tests * test get queryset * update config * merge from main * use main
- Loading branch information
Showing
15 changed files
with
127 additions
and
31 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
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 |
---|---|---|
|
@@ -6,5 +6,10 @@ coverage: | |
patch: | ||
default: | ||
target: 90% | ||
threshold: 1% | ||
project: | ||
default: | ||
target: 90% | ||
threshold: 1% | ||
|
||
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,15 @@ | ||
""" | ||
© Ocado Group | ||
Created on 16/04/2024 at 14:29:21(+01:00). | ||
""" | ||
|
||
from ...tests import ModelTestCase | ||
from .auth_factor import AuthFactor | ||
|
||
|
||
# pylint: disable-next=missing-class-docstring | ||
class TestAuthFactor(ModelTestCase[AuthFactor]): | ||
def test_str(self): | ||
"""String representation is as expected.""" | ||
auth_factor_type = AuthFactor.Type.OTP | ||
assert str(AuthFactor(type=auth_factor_type)) == str(auth_factor_type) |
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,18 @@ | ||
""" | ||
© Ocado Group | ||
Created on 16/04/2024 at 14:36:42(+01:00). | ||
""" | ||
|
||
from ...tests import ModelTestCase | ||
from .auth_factor import AuthFactor | ||
from .session_auth_factor import SessionAuthFactor | ||
|
||
|
||
# pylint: disable-next=missing-class-docstring | ||
class TestSessionAuthFactor(ModelTestCase[SessionAuthFactor]): | ||
def test_str(self): | ||
"""String representation is as expected.""" | ||
auth_factor_type = AuthFactor.Type.OTP | ||
assert str( | ||
SessionAuthFactor(auth_factor=AuthFactor(type=auth_factor_type)) | ||
) == str(auth_factor_type) |
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,29 @@ | ||
""" | ||
© Ocado Group | ||
Created on 16/04/2024 at 14:40:11(+01:00). | ||
""" | ||
|
||
from datetime import timedelta | ||
from unittest.mock import patch | ||
|
||
from django.utils import timezone | ||
|
||
from ...tests import ModelTestCase | ||
from .session import Session | ||
|
||
|
||
# pylint: disable-next=missing-class-docstring | ||
class TestSession(ModelTestCase[Session]): | ||
def test_is_expired(self): | ||
"""Can check if a session is expired.""" | ||
now = timezone.now() | ||
|
||
session = Session(expire_date=now - timedelta(hours=1)) | ||
with patch.object(timezone, "now", return_value=now) as timezone_now: | ||
assert session.is_expired | ||
timezone_now.assert_called_once() | ||
|
||
session = Session(expire_date=now + timedelta(hours=1)) | ||
with patch.object(timezone, "now", return_value=now) as timezone_now: | ||
assert not session.is_expired | ||
timezone_now.assert_called_once() |
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,16 @@ | ||
""" | ||
© Ocado Group | ||
Created on 16/04/2024 at 14:54:18(+01:00). | ||
""" | ||
|
||
from ...tests import ModelTestCase | ||
from .student import Independent | ||
|
||
|
||
# pylint: disable-next=missing-class-docstring | ||
class TestIndependent(ModelTestCase[Independent]): | ||
def test_objects__get_queryset(self): | ||
"""Check if only get independent students.""" | ||
self.assert_get_queryset( | ||
values=Independent.objects.filter(class_field__isnull=True) | ||
) |
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