aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/users')
-rw-r--r--ctrack/users/models.py7
-rw-r--r--ctrack/users/stakeholder.py7
-rw-r--r--ctrack/users/tests/test_models.py15
-rw-r--r--ctrack/users/tests/test_views.py3
4 files changed, 21 insertions, 11 deletions
diff --git a/ctrack/users/models.py b/ctrack/users/models.py
index 76dabf3..8f07b15 100644
--- a/ctrack/users/models.py
+++ b/ctrack/users/models.py
@@ -1,6 +1,5 @@
from django.contrib.auth.models import AbstractUser
-from django.db import models
-from django.db.models import BooleanField, CharField
+from django.db.models import CharField
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
@@ -13,7 +12,3 @@ class User(AbstractUser):
def get_absolute_url(self):
return reverse("users:detail", kwargs={"username": self.username})
-
-
-class UserProfile(models.Model):
- pass
diff --git a/ctrack/users/stakeholder.py b/ctrack/users/stakeholder.py
new file mode 100644
index 0000000..d15dd39
--- /dev/null
+++ b/ctrack/users/stakeholder.py
@@ -0,0 +1,7 @@
+from django.db import models
+
+from ctrack.organisations.models import Person
+
+
+class Stakeholder(models.Model):
+ person = models.ForeignKey(Person, on_delete=models.CASCADE)
diff --git a/ctrack/users/tests/test_models.py b/ctrack/users/tests/test_models.py
index c429b9c..2d45cca 100644
--- a/ctrack/users/tests/test_models.py
+++ b/ctrack/users/tests/test_models.py
@@ -1,16 +1,25 @@
import pytest
-from ctrack.users.models import User
+from ctrack.users.stakeholder import Stakeholder
pytestmark = pytest.mark.django_db
-def test_user_get_absolute_url(user: User):
+def test_user_get_absolute_url(user):
assert user.get_absolute_url() == f"/users/{user.username}/"
-def test_user_is_person_object(user: User):
+def test_user_is_person_object(user):
"""User comes from ctrack.conftest.
"""
assert user
+
+
+def test_stakeholder_model(person):
+ """
+ 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
diff --git a/ctrack/users/tests/test_views.py b/ctrack/users/tests/test_views.py
index 561c540..3299cd6 100644
--- a/ctrack/users/tests/test_views.py
+++ b/ctrack/users/tests/test_views.py
@@ -2,7 +2,6 @@ import pytest
from django.contrib.auth import get_user_model
from django.test import RequestFactory
-from ctrack.organisations.tests.factories import OrganisationFactory
from ctrack.users.models import User
from ctrack.users.views import UserDetailView, UserRedirectView, UserUpdateView
@@ -64,4 +63,4 @@ def test_profile_view_contains_organisation_information():
response = UserDetailView.as_view()(request, username=user.username)
assert response.status_code == 200
# TODO - work out how we can attach an organisation to the User model
- assert response.context_data["object"]
+ assert False, "This does nothing yet"