From b408d90f52766861071b6fefe01f8bf9d213432e Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 8 Dec 2022 08:32:26 +0300 Subject: auth: test for `user_resources` function (incomplete) * gn3/auth/authorisation/resources.py: dummy `user_resources` function * tests/unit/auth/conftest.py: (incomplete): Add some fixtures for testing the `user_resources` function * tests/unit/auth/test_resources.py: test the `user_resources` function --- gn3/auth/authorisation/resources.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gn3') diff --git a/gn3/auth/authorisation/resources.py b/gn3/auth/authorisation/resources.py index 095a72c..2c0b72b 100644 --- a/gn3/auth/authorisation/resources.py +++ b/gn3/auth/authorisation/resources.py @@ -3,6 +3,8 @@ from uuid import UUID, uuid4 from typing import Sequence, NamedTuple from gn3.auth import db +from gn3.auth.authentication.users import User + from .checks import authorised_p from .exceptions import AuthorisationError from .groups import Group, authenticated_user_group @@ -70,3 +72,7 @@ def public_resources(conn: db.DbConnection) -> Sequence[Resource]: Resource(groups[row[0]], UUID(row[1]), row[2], categories[row[3]], bool(row[4])) for row in results) + +def user_resources(conn: db.DbConnection, user: User) -> Sequence[Resource]:# pylint: disable=[unused-argument] + """List the resources available to the user""" + return tuple() -- cgit v1.2.3