aboutsummaryrefslogblamecommitdiffstats
path: root/ctrack/organisations/tests/test_models.py
blob: c6314af11df38f4c4da18716ee01cfac01db80d2 (plain) (tree)
1
2
3
4
5
6
7
8
9


                           
                                                                    



                                  
                                            

                                                              

 
                                              
                                         


                                                

 
                           

                                       
import pytest
from slugify import slugify

from ctrack.organisations.models import IncidentReport, Organisation

pytestmark = pytest.mark.django_db


def test_organisation_get_absolute_url(org):
    slug = slugify(org.name)
    assert org.get_absolute_url() == f"/organisations/{slug}/"


def test_update_organisation(org_with_people):
    # Change the name of the organisation
    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