NOTE: This test requires administrator access.
(1) From Site administration>Users>Permissions>Define roles, create a new role 'Keyholder'
(2) Set only the new capability enrol/self:holdkey to 'Allow'.
(3) Set the context to 'Course'.
(4) Add the keyholder role to Course contacts from Site administration>Appearance>Courses
(5) Navigate to a course and enable self enrolment with an enrolment key
(6) Enrol a user as Keyholder and a different user as Teacher.
(7) Log into the site as a student and attempt to enrol in the course.
(8) Verify that you see the keyholder's name as a link and message 'You should have received this enrolment key from (name of Keyholder in #5)' and not the Teacher in #5)
(9) Now edit the keyholder role to be in the 'Category' context.
(10) Choose a category on your site and from Category adminstration>Assign roles, give a user the Keyholder role for this category.
(11) Create two new courses with self enrolment and an enrolment key.
(12) Log in as the student and verify that in each course you see the keyholder's name as a link and the message You should have received this enrolment key from (name of Keyholder in #9)