diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-05-28 16:53:26 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-05-28 16:53:26 +0100 |
commit | 2fd651e2cb3a4cd3a31921032af0279d156dd053 (patch) | |
tree | 51d2daaff266969721739f8f67cd2516aa8fa126 /ctrack | |
parent | 3fe0659a634f9cb55d50f308aa88ba78445953a1 (diff) |
starting to test for org to work with incident form
Diffstat (limited to 'ctrack')
-rw-r--r-- | ctrack/organisations/tests/conftest.py | 30 | ||||
-rw-r--r-- | ctrack/organisations/tests/test_incident_report.py | 2 | ||||
-rw-r--r-- | ctrack/organisations/tests/test_models.py | 19 |
3 files changed, 41 insertions, 10 deletions
diff --git a/ctrack/organisations/tests/conftest.py b/ctrack/organisations/tests/conftest.py index 1435c86..ce72835 100644 --- a/ctrack/organisations/tests/conftest.py +++ b/ctrack/organisations/tests/conftest.py @@ -1,11 +1,39 @@ - # TODO Here we need to make use of the populate script to create a massive # test fixture. import pytest from ctrack.core.utils import populate_db +from ctrack.organisations.tests.factories import ( + OrganisationFactory, + PersonFactory, + RoleFactory, +) @pytest.fixture def full_db_fixture(): populate_db(orgs=2, igps=2) + + +@pytest.fixture +def role(): + return RoleFactory.create(name="Test Role") + + +@pytest.fixture +def org_with_people(role): + org = OrganisationFactory.create( + submode=None, + name="TEST ORGANISATION", + designation_type=3, + registered_company_name="Test PLC", + comments="NA", + ) + PersonFactory.create( + role=role, + job_title="Test Job Title", + predecessor=None, + organisation__submode=None, + organisation=org, + ) + return org diff --git a/ctrack/organisations/tests/test_incident_report.py b/ctrack/organisations/tests/test_incident_report.py deleted file mode 100644 index 0bf76ef..0000000 --- a/ctrack/organisations/tests/test_incident_report.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_there_is_a_view_function_for_incident_report(): - pass diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py index 416a9fd..6c41c49 100644 --- a/ctrack/organisations/tests/test_models.py +++ b/ctrack/organisations/tests/test_models.py @@ -11,21 +11,26 @@ def test_organisation_get_absolute_url(org): assert org.get_absolute_url() == f"/organisations/{slug}/" -def test_delete_organisation(org): +def test_delete_organisation(org_with_people): orgs = Organisation.objects.all() - assert org in orgs - Organisation.delete(org) + assert org_with_people in orgs + Organisation.delete(org_with_people) # Assert that the record has been deleted assert Organisation.objects.count() == 0 -def test_update_organisation(org): +def test_update_organisation(org_with_people): # Change the name of the organisation - org.name = "Tonkers Ltd" - org.save() - assert org.name == "Tonkers Ltd" + org_with_people.name = "Tonkers Ltd" + org_with_people.save() + assert org_with_people.name == "Tonkers Ltd" def test_new_address(addr): # The address "has" an organisation assert addr.organisation.name + + +def test_incident_report(org_with_people): + breakpoint() + pass |