aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/auth/test_groups.py
AgeCommit message (Expand)Author
2023-04-25auth: Roles: Check for editability...Some roles should not be user-editable, and as such, we need to check before allowing any edits on such roles. This commit makes that possible. Frederick Muriuki Muriithi
2023-03-09auth: redis data: migrate data in redis...Implement the code to migrate the data from redis to SQLite. Frederick Muriuki Muriithi
2023-02-03auth: tests: mock token acquisition. Fix minor bugs.Frederick Muriuki Muriithi
2023-02-02auth: Reorganise modules/packages for easier dev and maintenance...Split the views/routes into separate modules each dealing with a narrower scope of the application to aid in maintenance, and help with making the development easier. Frederick Muriuki Muriithi
2023-01-23auth: create group: Fix group creation....* gn3/auth/authorisation/checks.py: Enable passing user to authorisation checking function. Raise error on authorisation failure for consistent error handling. * gn3/auth/authorisation/groups.py: Add user to group, updating the privileges as appropriate. * gn3/auth/authorisation/resources.py: Fix resources querying * gn3/auth/authorisation/roles.py: Assign/revoke roles by name * gn3/auth/authorisation/views.py: Create group * migrations/auth/20221108_01_CoxYh-create-the-groups-table.py: Add group_metadata field * tests/unit/auth/fixtures/group_fixtures.py: fix tests * tests/unit/auth/test_groups.py: fix tests * tests/unit/auth/test_resources.py: fix tests * tests/unit/auth/test_roles.py: fix tests Frederick Muriuki Muriithi
2023-01-18auth: Fix tests after enforcing FOREIGN KEY constraint...Fix a number of tests and fixtures that were not conforming to the FOREIGN KEY constraints: * Each test that creates a new "object" needs to clean up after itself * Each fixture that sets up test data needs to clean up after itself Frederick Muriuki Muriithi
2023-01-16auth: update privileges format...Save privileges with ids of the form <top-level>:<sub-level>:<privilege-name> rather than using a UUID, to reduce indirection levels. * migrations/auth/20230116_01_KwuJ3-rework-privileges-schema.py: new migration to change the schema and IDs for the privileges. * Update code to use new privileges format * gn3/auth/authorisation/checks.py * gn3/auth/authorisation/groups.py * gn3/auth/authorisation/privileges.py * gn3/auth/authorisation/resources.py * gn3/auth/authorisation/roles.py * migrations/auth/20230116_01_KwuJ3-rework-privileges-schema.py * tests/unit/auth/fixtures/role_fixtures.py * tests/unit/auth/test_groups.py * tests/unit/auth/test_privileges.py * tests/unit/auth/test_roles.py Frederick Muriuki Muriithi
2023-01-03auth: rename fixtures: test_* -> fxtr_*...Since test functions are defined starting with "test_", rename the fixture to more clearly indicate it is a fixture (fxtr_*), an not a test in itself. Frederick Muriuki Muriithi
2022-12-12auth: pass cursor object to `user_group` functionFrederick Muriuki Muriithi
2022-12-12auth: Attach group to GroupRole, rather than group_idFrederick Muriuki Muriithi
2022-12-08tests: Fix issues caught by tests...The addition of the `public` field in the `resources` table, led to some previously passing tests to fail. This commit fixes the failures, and cleans up some pylint issues. * gn3/auth/authorisation/resources.py: add `public` to db queries * tests/unit/auth/test_groups.py: fix pylint issues Frederick Muriuki Muriithi
2022-12-08auth: add function to retrieve a user's group...* gn3/auth/authorisation/groups.py: new `user_group` function * tests/unit/auth/test_groups.py: test `user_group` function Frederick Muriuki Muriithi
2022-11-24auth: Check for authentication and fix errors...* gn3/auth/authorisation/groups.py: base `MembershipError` on new `AuthorisationError` base exception. Use new authentication checking decorator. * gn3/auth/authorisation/privileges.py: Change argument to User object rather than UUID object * gn3/auth/authorisation/roles.py: Use new authentication checking decorator. * tests/unit/auth/test_groups.py: use `conftest.TEST_USER` * tests/unit/auth/test_privileges.py: use `conftest.TEST_USER` * tests/unit/auth/test_roles.py: use `conftest.TEST_USER` Frederick Muriuki Muriithi
2022-11-21auth: Prevent group leader from being a member of multiple groups...* gn3/auth/authorisation/groups.py: Assign the group leader at group creation time. * tests/unit/auth/test_groups.py: Ensure the group leader is only ever a member of a single group. Frederick Muriuki Muriithi
2022-11-17auth: Finish implementation of `create_group_role`...* gn3/auth/authorisation/groups.py: Add `GroupRole` type. Fix typing annotations. Fix bugs. * tests/unit/auth/conftest.py: Fix bugs. * tests/unit/auth/test_groups.py: Fix test to run. Frederick Muriuki Muriithi
2022-11-17tests: Add test to check creation of roles attached to groups...* tests/unit/auth/conftest.py: Add fixtures to help with testing * tests/unit/auth/test_groups.py: Add incomplete and failing test Frederick Muriuki Muriithi
2022-11-15auth: Return results of calling function directly...* gn3/auth/authorisation/checks.py: Return results of calling the function rather than a dict of values that include the results. * gn3/auth/authorisation/groups.py: Use the newer form of `authorised_p` decorator. * tests/unit/auth/test_groups.py: Update tests Frederick Muriuki Muriithi
2022-11-15pylint: Fix a myriad of linting errorsFrederick Muriuki Muriithi
2022-11-15tests: Fix cause of `DeprecationWarning`...* tests/unit/auth/test_groups.py: use Flask's application context directly rather than the request context to access `g` in order to get rid of the `DeprecationWarning`. Frederick Muriuki Muriithi
2022-11-14auth: Implement `create_group`Frederick Muriuki Muriithi
2022-11-14auth: Add test for `create_group`...* gn3/auth/authorisation/__init__.py: Add `authorised_p` decorator to be used for all function requiring authorisation. * gn3/auth/authorisation/groups.py: Add `create_group` function stub * tests/unit/auth/conftest.py: Add fixture for test users * tests/unit/auth/test_groups.py: Add tests for `create_group` Frederick Muriuki Muriithi