diff options
author | Frederick Muriuki Muriithi | 2023-10-02 09:00:13 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-10-02 09:00:13 +0300 |
commit | dd00a799a7f8b00c7f27460cb2be2b39b8a47c1c (patch) | |
tree | c8416fdaafc7b5006d33f550c840392c08d701dc /tests/unit/auth | |
parent | 90d1b58ebd169158dd2022565ce23d78c9230085 (diff) | |
download | gn-auth-dd00a799a7f8b00c7f27460cb2be2b39b8a47c1c.tar.gz |
migrations: New migration - InbredSet Resources
Provide a new migration to create tables to handle the InbredSet
resources. The migration also sets up the resource category and the
related privileges.
Diffstat (limited to 'tests/unit/auth')
-rw-r--r-- | tests/unit/auth/test_migrations_add_data_to_table.py | 16 | ||||
-rw-r--r-- | tests/unit/auth/test_migrations_create_tables.py | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/unit/auth/test_migrations_add_data_to_table.py b/tests/unit/auth/test_migrations_add_data_to_table.py index b686f25..d9e2ca4 100644 --- a/tests/unit/auth/test_migrations_add_data_to_table.py +++ b/tests/unit/auth/test_migrations_add_data_to_table.py @@ -22,7 +22,21 @@ test_params = ( ("a0e67630-d502-4b9f-b23f-6805d0f30e30", "5103cc68-96f8-4ebb-83a4-a31692402c9b"), ("a0e67630-d502-4b9f-b23f-6805d0f30e30", - "1c59eff5-9336-4ed2-a166-8f70d4cb012e"))),) + "1c59eff5-9336-4ed2-a166-8f70d4cb012e"))), + ("20231002_01_tzxTf-link-inbredsets-to-auth-system.py", + "SELECT privilege_id FROM privileges WHERE privilege_id IN (?, ?, ?, ?, ?, ?)", + ("system:inbredset:create-case-attribute", + "system:inbredset:delete-case-attribute", + "system:inbredset:edit-case-attribute", + "system:inbredset:view-case-attribute", + "system:inbredset:apply-case-attribute-edit", + "system:inbredset:reject-case-attribute-edit"), + (("system:inbredset:create-case-attribute",), + ("system:inbredset:delete-case-attribute",), + ("system:inbredset:edit-case-attribute",), + ("system:inbredset:view-case-attribute",), + ("system:inbredset:apply-case-attribute-edit",), + ("system:inbredset:reject-case-attribute-edit",)))) @pytest.mark.unit_test @pytest.mark.parametrize("migration_file,query,query_params,data", test_params) diff --git a/tests/unit/auth/test_migrations_create_tables.py b/tests/unit/auth/test_migrations_create_tables.py index 8b0f36e..90c3fb8 100644 --- a/tests/unit/auth/test_migrations_create_tables.py +++ b/tests/unit/auth/test_migrations_create_tables.py @@ -43,7 +43,11 @@ migrations_and_tables = ( ("20230907_01_pjnxz-refactor-add-resource-ownership-table.py", "resource_ownership"), ("20230907_04_3LnrG-refactor-create-group-resources-table.py", - "group_resources")) + "group_resources"), + ("20231002_01_tzxTf-link-inbredsets-to-auth-system.py", + "linked_inbredset_groups"), + ("20231002_01_tzxTf-link-inbredsets-to-auth-system.py", + "inbredset_group_resources")) @pytest.mark.unit_test @pytest.mark.parametrize("migration_file,the_table", migrations_and_tables) @@ -64,6 +68,7 @@ def test_create_table( apply_single_migration(backend, get_migration(migration_path)) cursor.execute("SELECT name FROM sqlite_schema WHERE type='table'") result_after_migration = cursor.fetchall() + rollback_single_migration(backend, get_migration(migration_path)) rollback_migrations(backend, older_migrations) assert the_table not in [row[0] for row in result_before_migration] |