From 4e572eba5fa89a0ae4c5c732babe8c4bc011d435 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 30 May 2023 13:04:27 +0300 Subject: Fix linting errors and failing tests * scripts/register_sys_admin.py: fix linting error * tests/unit/auth/fixtures/oauth2_client_fixtures.py: hash client secret in database. The code expects it hashed in the database. --- tests/unit/auth/fixtures/oauth2_client_fixtures.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/unit') diff --git a/tests/unit/auth/fixtures/oauth2_client_fixtures.py b/tests/unit/auth/fixtures/oauth2_client_fixtures.py index 41d3ed4..654d048 100644 --- a/tests/unit/auth/fixtures/oauth2_client_fixtures.py +++ b/tests/unit/auth/fixtures/oauth2_client_fixtures.py @@ -6,6 +6,7 @@ import datetime import pytest from gn3.auth import db +from gn3.auth.authentication.users import hash_password from gn3.auth.authentication.oauth2.models.oauth2client import OAuth2Client @pytest.fixture(autouse=True) @@ -36,7 +37,7 @@ def fxtr_oauth2_clients(fxtr_users_with_passwords): with db.cursor(conn) as cursor: cursor.executemany( "INSERT INTO oauth2_clients VALUES (?, ?, ?, ?, ?, ?)", - ((str(client.client_id), client.client_secret, + ((str(client.client_id), hash_password(client.client_secret), int(client.client_id_issued_at.timestamp()), int(client.client_secret_expires_at.timestamp()), json.dumps(client.client_metadata), str(client.user.user_id)) -- cgit v1.2.3