mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-30 13:03:14 +02:00
Fix fixtures
This commit is contained in:
parent
74978ba5ba
commit
9119339203
1 changed files with 3 additions and 3 deletions
|
@ -196,12 +196,12 @@ class UserFixture:
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def load_users(cls, users, group_name):
|
def load_users(cls, users, group_name, set_users_superusers=False):
|
||||||
logger.info(f"Going to load {len(users)} users in group {group_name}")
|
logger.info(f"Going to load {len(users)} users in group {group_name}")
|
||||||
for user_data in users:
|
for user_data in users:
|
||||||
try:
|
try:
|
||||||
user, _ = User.objects.get_or_create(username=user_data["username"])
|
user, _ = User.objects.get_or_create(username=user_data["username"])
|
||||||
user.is_superuser = False
|
user.is_superuser = set_users_superusers
|
||||||
user.first_name = user_data["first_name"]
|
user.first_name = user_data["first_name"]
|
||||||
user.last_name = user_data["last_name"]
|
user.last_name = user_data["last_name"]
|
||||||
if "email" in user_data:
|
if "email" in user_data:
|
||||||
|
@ -229,5 +229,5 @@ class UserFixture:
|
||||||
# steps now do not need to close/reopen a db connection,
|
# steps now do not need to close/reopen a db connection,
|
||||||
# instead they share one.
|
# instead they share one.
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
cls.load_users(cls, cls.ADMINS, "full_access_group")
|
cls.load_users(cls, cls.ADMINS, "full_access_group", set_users_superusers=True)
|
||||||
cls.load_users(cls, cls.STAFF, "cisa_analysts_group")
|
cls.load_users(cls, cls.STAFF, "cisa_analysts_group")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue