aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/core/utils.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-05-31 11:40:43 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-05-31 11:40:43 +0100
commit5c6b9e60547a5884b7debe450aa0ddaea075d4f9 (patch)
tree3aa263142f691d311f754da53b8a31dfaad23928 /ctrack/core/utils.py
parent9917bd1793d0362b84704d0ad4409be4ec9dbdd3 (diff)
working on user groups and tests
Diffstat (limited to 'ctrack/core/utils.py')
-rw-r--r--ctrack/core/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py
index bebf176..ef998d0 100644
--- a/ctrack/core/utils.py
+++ b/ctrack/core/utils.py
@@ -1,6 +1,8 @@
import random
from random import choice, randint
+from django.contrib.auth import get_user_model
+from django.contrib.auth.models import Group
from faker import Faker
from ctrack.assessments.models import (
@@ -69,6 +71,9 @@ def populate_db(**kwargs):
_org_number = kwargs.get("orgs")
_igp_number = kwargs.get("igps")
+ # Groups
+ cct_staff_group = Group.objects.create(name="cct_users")
+
# Set up some reasonable Modes and SubModes
m1 = Mode.objects.create(descriptor="Rail")
m2 = Mode.objects.create(descriptor="Maritime")
@@ -155,6 +160,10 @@ def populate_db(**kwargs):
)
for _ in range(5)
]
+ inspector_user = get_user_model().objects.create(
+ username="inspector1", name="inspector1"
+ )
+ inspector_user.groups.add(cct_staff_group)
etf1 = EngagementTypeFactory(descriptor="Information Notice")
etf2 = EngagementTypeFactory(descriptor="Designation Letter")