Skip to content

Commit

Permalink
[CW-567] Modifier la génération des fake data afin de s'assurer qu'el…
Browse files Browse the repository at this point in the history
…les contiennent toujours au moins un admin
  • Loading branch information
notoraptor committed Dec 6, 2024
1 parent e2d3b0e commit d27dcbf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 37 deletions.
33 changes: 0 additions & 33 deletions scripts/ensure_one_fake_admin_in_db.py

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/launch_frontend_tests_in_clockwork_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ playwright install chromium
echo Store fake data
python3 scripts/store_fake_data_in_db.py

echo Ensure at least 1 fake admin user
python3 scripts/ensure_one_fake_admin_in_db.py

echo Launch clockwork web server in background
python3 -m flask run --host="0.0.0.0" &

Expand Down
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 @@ -37,7 +37,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 d27dcbf

Please sign in to comment.