-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17fcad6
commit 7618b53
Showing
14 changed files
with
174 additions
and
12 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
Empty file.
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,14 @@ | ||
import pytest | ||
from django.contrib.admin.sites import AdminSite | ||
from model_bakery import baker | ||
|
||
from mycarehub.clients.admin import ClientAdmin | ||
from mycarehub.clients.models import Client | ||
|
||
pytestmark = pytest.mark.django_db | ||
|
||
|
||
def test_client_admin_get_user_name(user_with_all_permissions): | ||
admin = ClientAdmin(model=Client, admin_site=AdminSite()) | ||
client = baker.make(Client, user=user_with_all_permissions) | ||
assert admin.get_user_name(client) == user_with_all_permissions.name |
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,32 @@ | ||
import pytest | ||
from model_bakery import baker | ||
|
||
from mycarehub.clients.models import Client, Identifier, RelatedPerson | ||
|
||
pytestmark = pytest.mark.django_db | ||
|
||
|
||
def test_identifier_str(): | ||
identifier = baker.make( | ||
Identifier, | ||
identifier_value="222", | ||
identifier_type="NATIONAL_ID", | ||
identifier_use="OFFICIAL", | ||
) | ||
assert str(identifier) == "222 (NATIONAL_ID, OFFICIAL)" | ||
|
||
|
||
def test_related_person_str(): | ||
related_person = baker.make( | ||
RelatedPerson, | ||
first_name="Juha", | ||
last_name="Mwenyewe", | ||
other_name="Kalulu", | ||
relationship_type="SPOUSE", | ||
) | ||
assert str(related_person) == "Juha Kalulu Mwenyewe (SPOUSE)" | ||
|
||
|
||
def test_client_str(user_with_all_permissions): | ||
client = baker.make(Client, user=user_with_all_permissions, client_type="PMTCT") | ||
assert str(client) == f"{user_with_all_permissions.name} (PMTCT)" |
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,21 @@ | ||
# Generated by Django 3.2.9 on 2021-11-23 03:27 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('common', '0010_auto_20211119_0628'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='contact', | ||
name='user', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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,26 @@ | ||
# Generated by Django 3.2.9 on 2021-11-23 03:36 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('common', '0011_alter_contact_user'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='contact', | ||
name='flavour', | ||
field=models.CharField(blank=True, choices=[('PRO', 'PRO'), ('CONSUMER', 'CONSUMER')], max_length=32, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='contact', | ||
name='user', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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,20 @@ | ||
# Generated by Django 3.2.9 on 2021-11-23 03:27 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0015_user_pin_change_required'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='userotp', | ||
name='user', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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