From 37300a0280e1467e9e2fdcdf6bf7dcbe1ba2081b Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Tue, 11 Feb 2025 09:47:42 +0100 Subject: [PATCH] Add TEST_USER as a possible role type This role is always found in combination with other role so this change shouldn't have an immediate impact on the system. From the spec: https://www.imsglobal.org/spec/lti/v1p3#lti-vocabulary-for-system-roles This is a marker role to be used in conjunction with a "real" role. It indicates this user is created by the platform for testing different user scenarios. --- lms/models/lti_role.py | 2 ++ tests/unit/lms/models/lti_role_test.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/models/lti_role.py b/lms/models/lti_role.py index fb8da72d2b..dd66a73d11 100644 --- a/lms/models/lti_role.py +++ b/lms/models/lti_role.py @@ -20,6 +20,7 @@ class RoleType(StrEnum): LEARNER = "learner" ADMIN = "admin" NONE = "none" + TEST_USER = "test_user" @unique @@ -168,6 +169,7 @@ class _RoleParser: "SysSupport": RoleType.ADMIN, "TeachingAssistant": RoleType.INSTRUCTOR, "User": RoleType.LEARNER, + "TestUser": RoleType.TEST_USER, } @classmethod diff --git a/tests/unit/lms/models/lti_role_test.py b/tests/unit/lms/models/lti_role_test.py index ed255ab2cf..e8877f8e81 100644 --- a/tests/unit/lms/models/lti_role_test.py +++ b/tests/unit/lms/models/lti_role_test.py @@ -193,7 +193,7 @@ class TestLTIRole: ), ( "http://purl.imsglobal.org/vocab/lti/system/person#TestUser", - RoleType.LEARNER, + RoleType.TEST_USER, RoleScope.SYSTEM, ), ],