aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-11-16 13:02:04 +0300
committerFrederick Muriuki Muriithi2022-11-16 13:03:56 +0300
commit366ad0315ed90ac4496714de9e84c04530fec278 (patch)
tree5b22beb4b664426b7ec0b277ab81111f38c2a023 /migrations
parent25da0232ac52509d6761e36ad80ed53b8dbbb64e (diff)
downloadgenenetwork3-366ad0315ed90ac4496714de9e84c04530fec278.tar.gz
tests: Add tests for privileges
* migrations/auth/20221116_01_nKUmX-add-privileges-to-group-leader-role.py: new migration to fix data errors. * tests/unit/auth/test_privileges.py: test privileges
Diffstat (limited to 'migrations')
-rw-r--r--migrations/auth/20221116_01_nKUmX-add-privileges-to-group-leader-role.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/migrations/auth/20221116_01_nKUmX-add-privileges-to-group-leader-role.py b/migrations/auth/20221116_01_nKUmX-add-privileges-to-group-leader-role.py
new file mode 100644
index 0000000..2e4ae28
--- /dev/null
+++ b/migrations/auth/20221116_01_nKUmX-add-privileges-to-group-leader-role.py
@@ -0,0 +1,35 @@
+"""
+Add privileges to 'group-leader' role.
+"""
+
+from yoyo import step
+
+__depends__ = {'20221114_05_hQun6-create-user-roles-table'}
+
+steps = [
+ step(
+ """
+ INSERT INTO role_privileges(role_id, privilege_id)
+ VALUES
+ -- role management
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '221660b1-df05-4be1-b639-f010269dbda9'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '7bcca363-cba9-4169-9e31-26bdc6179b28'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '5103cc68-96f8-4ebb-83a4-a31692402c9b'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '1c59eff5-9336-4ed2-a166-8f70d4cb012e')
+ """,
+ """
+ DELETE FROM role_privileges
+ WHERE
+ role_id='a0e67630-d502-4b9f-b23f-6805d0f30e30'
+ AND privilege_id IN (
+ '221660b1-df05-4be1-b639-f010269dbda9',
+ '7bcca363-cba9-4169-9e31-26bdc6179b28',
+ '5103cc68-96f8-4ebb-83a4-a31692402c9b',
+ '1c59eff5-9336-4ed2-a166-8f70d4cb012e'
+ )
+ """)
+]