diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-21 17:02:29 +0000 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-21 17:02:29 +0000 |
commit | 490fc024506c9ed9f9c0b5a4cfbcdecc95127dbe (patch) | |
tree | 8cdd80340feb140115ca8fd4e5faf101ffb5ffcf /ctrack/organisations | |
parent | 1aade17fe69e52973fd43c4090dbdfaf50009c89 (diff) |
testing we can update an organisation
Diffstat (limited to 'ctrack/organisations')
-rw-r--r-- | ctrack/organisations/tests/test_models.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py index 460d3d7..d070a84 100644 --- a/ctrack/organisations/tests/test_models.py +++ b/ctrack/organisations/tests/test_models.py @@ -13,5 +13,26 @@ def test_organisation_get_absolute_url(org: Organisation): def test_create_organisation(addr: Address): Organisation(name="Big Bad OES Corporation", address=addr).save() + # The organisation is saved in the db assert Organisation.objects.get(name="Big Bad OES Corporation") + # The organisation has the correct address assert Organisation.objects.get(name="Big Bad OES Corporation").address.type.descriptor == "Primary Address" + + +def test_delete_organisation(org: Organisation): + orgs = Organisation.objects.all() + assert org in orgs + Organisation.delete(org) + # Assert that the record has been deleted + assert Organisation.objects.count() == 0 + + +def test_update_organisation(org: Organisation): + # Change the name of the organisation + org.name = "Tonkers Ltd" + # Get current value of line1 of the address + addr_line1 = org.address.line1 + org.save() + assert org.name == "Tonkers Ltd" + # Assert that the address hasn't changed + assert addr_line1 == org.address.line1 |