From 75cad4697874dc1e06f1758dd9915394f7287d63 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 25 May 2020 16:09:41 +0100 Subject: in trying to create a Stakeholder model referenced from User, have removed updated_by fields in other models and factories - was getting circular dep error --- ctrack/users/tests/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctrack/users/tests/test_models.py') diff --git a/ctrack/users/tests/test_models.py b/ctrack/users/tests/test_models.py index 2d45cca..96bd4b9 100644 --- a/ctrack/users/tests/test_models.py +++ b/ctrack/users/tests/test_models.py @@ -1,6 +1,6 @@ import pytest -from ctrack.users.stakeholder import Stakeholder +from ctrack.organisations.models import Stakeholder pytestmark = pytest.mark.django_db -- cgit v1.2.3 From 37abea2c01a93abe50609268d742308064fef138 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 25 May 2020 16:26:56 +0100 Subject: linked stakeholder to user --- ctrack/users/tests/test_models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ctrack/users/tests/test_models.py') diff --git a/ctrack/users/tests/test_models.py b/ctrack/users/tests/test_models.py index 96bd4b9..504195f 100644 --- a/ctrack/users/tests/test_models.py +++ b/ctrack/users/tests/test_models.py @@ -16,10 +16,11 @@ def test_user_is_person_object(user): assert user -def test_stakeholder_model(person): +def test_stakeholder_model(person, user): """ A stakeholder is someone who is part of the regime but also has user access to the the system. """ stakeholder = Stakeholder(person=person) - assert stakeholder + user.stakeholder = stakeholder + assert user.stakeholder.person.first_name == "Chinaplate" -- cgit v1.2.3 From edb07988cbe91bd5faef1fa5b79f7406f1ea06d7 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 25 May 2020 16:41:32 +0100 Subject: more testing for stakeholder --- ctrack/users/tests/test_models.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ctrack/users/tests/test_models.py') diff --git a/ctrack/users/tests/test_models.py b/ctrack/users/tests/test_models.py index 504195f..402c41b 100644 --- a/ctrack/users/tests/test_models.py +++ b/ctrack/users/tests/test_models.py @@ -22,5 +22,8 @@ def test_stakeholder_model(person, user): the system. """ stakeholder = Stakeholder(person=person) + org = person.organisation.name user.stakeholder = stakeholder assert user.stakeholder.person.first_name == "Chinaplate" + assert user.is_stakeholder() is True + assert user.get_organisation_name() == org -- cgit v1.2.3 From fa674ad70439cea0de962b87e5ac4c4dc0fa16f7 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 27 May 2020 16:21:51 +0100 Subject: working through permissions issues --- ctrack/users/tests/test_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ctrack/users/tests/test_models.py') diff --git a/ctrack/users/tests/test_models.py b/ctrack/users/tests/test_models.py index 402c41b..368be34 100644 --- a/ctrack/users/tests/test_models.py +++ b/ctrack/users/tests/test_models.py @@ -24,6 +24,6 @@ def test_stakeholder_model(person, user): stakeholder = Stakeholder(person=person) org = person.organisation.name user.stakeholder = stakeholder - assert user.stakeholder.person.first_name == "Chinaplate" - assert user.is_stakeholder() is True + assert user.stakeholder.person.first_name == "Toss" + assert user.is_stakeholder is True assert user.get_organisation_name() == org -- cgit v1.2.3