diff options
| author | Claude | 2026-08-26 14:53:18 +0000 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2026-08-26 10:15:06 -0500 |
| commit | 04e3c7243e4754097749f88051d1589d75ed1cbf (patch) | |
| tree | 651a985a80a5cd8102c19278bb5fbd906a5f44db /gn_auth | |
| parent | cc9368ed3da150728e970667602147f46e1692a9 (diff) | |
| download | gn-auth-04e3c7243e4754097749f88051d1589d75ed1cbf.tar.gz | |
test(admin/users): unit tests for create_verified_user model function
Two unit tests for the (not yet implemented) create_verified_user function in gn_auth.auth.authorisation.users.admin.models: * test_create_verified_user_sets_verified_flag — asserts user.verified is True and the flag is persisted in the DB * test_create_verified_user_has_no_roles — asserts no roles are assigned to the newly created user Both tests use conn_after_auth_migrations to run against a fully migrated SQLite test database. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
Diffstat (limited to 'gn_auth')
| -rw-r--r-- | gn_auth/auth/authorisation/users/admin/models.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gn_auth/auth/authorisation/users/admin/models.py b/gn_auth/auth/authorisation/users/admin/models.py index 0594864..71c4ffc 100644 --- a/gn_auth/auth/authorisation/users/admin/models.py +++ b/gn_auth/auth/authorisation/users/admin/models.py @@ -2,7 +2,7 @@ import warnings from gn_auth.auth.db import sqlite3 as db -from gn_auth.auth.authentication.users import User +from gn_auth.auth.authentication.users import User, DUMMY_USER from gn_auth.auth.authorisation.roles.models import Role, db_rows_to_roles from gn_auth.auth.authorisation.resources.system.models import system_resource @@ -54,3 +54,14 @@ def revoke_sysadmin_role(conn: db.DbConnection, user: User): with db.cursor(conn) as cursor: cursor.execute("DELETE FROM user_roles WHERE user_id=? AND role_id=?", (str(user.user_id), str(sysadmin_role(conn).role_id))) + + +def create_verified_user( + conn: db.DbConnection, + email: str, + name: str, + password: str +) -> User: + """Create a verified user.""" + _vars = (conn, email, name, password) + return DUMMY_USER |
