Skip to content

Commit

Permalink
Merge pull request #211 from notoraptor/cw-567-ensure-fake-admin
Browse files Browse the repository at this point in the history
[CW-567] Modifier la génération des fake data afin de s'assurer qu'elles contiennent toujours au moins un admin
  • Loading branch information
soline-b authored Jan 17, 2025
2 parents 4f5a713 + d27dcbf commit 844aa9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions scripts/produce_fake_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def gen_single_user(n):
# This is useful for testing permissions.
cc_account_username = "ccuser%0.2d" % n if not n % 20 == 6 else None

# One out of 20 of the users will be an admin
# (actually matching student02 in 20 first users).
admin_rights = {"admin_access": True} if n % 20 == 2 else {}

D_user = {
"mila_email_username": "student%[email protected]" % n,
"status": status,
Expand All @@ -73,6 +77,7 @@ def gen_single_user(n):
"dark_mode": False,
"language": "en" if (n % 2 == 0) else "fr",
},
**admin_rights,
}

if cc_account_username is not None:
Expand Down
4 changes: 4 additions & 0 deletions slurm_report/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# As this folder is used to generate test data,
# Git could ignore everything here, except README file.
*
!README.md
3 changes: 2 additions & 1 deletion test_common/fake_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"nbr_items_per_page": 40,
"dark_mode": false,
"language": "en"
}
},
"admin_access": true
},
{
"mila_email_username": "[email protected]",
Expand Down

0 comments on commit 844aa9d

Please sign in to comment.