From dd7ece1240b30df9797593d5cbd3cb2a41430603 Mon Sep 17 00:00:00 2001 From: Edmund Farrow <edmund.farrow@ed.ac.uk> Date: Wed, 11 Dec 2024 11:52:35 +0000 Subject: [PATCH] ci-again - Fix tests --- tests/library_import_test.php | 8 ++++---- tests/library_render_test.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/library_import_test.php b/tests/library_import_test.php index 44b4b50a4..a5f36ae8a 100644 --- a/tests/library_import_test.php +++ b/tests/library_import_test.php @@ -105,13 +105,13 @@ final class library_import_test extends externallib_advanced_testcase { } /** - * Test the library_import function fails when no webservice export capability assigned. + * Test the library_import function fails when no capability to add questions assigned. */ - public function test_no_webservice_access(): void { + public function test_no_access(): void { global $DB; $context = context_course::instance($this->course->id); - $studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student']); - role_assign($studentroleid, $this->user->id, $context->id); + $teacherroleid = $DB->get_field('role', 'id', ['shortname' => 'teacher']); + role_assign($teacherroleid, $this->user->id, $context->id); $this->getDataGenerator()->enrol_user($this->user->id, $this->course->id); $this->expectException(required_capability_exception::class); $this->expectExceptionMessage('you do not currently have permissions to do that (Add new questions).'); diff --git a/tests/library_render_test.php b/tests/library_render_test.php index e0f550ea0..98383e4c3 100644 --- a/tests/library_render_test.php +++ b/tests/library_render_test.php @@ -108,13 +108,13 @@ final class library_render_test extends externallib_advanced_testcase { } /** - * Test the library_render function fails when no webservice export capability assigned. + * Test the library_render function fails when no capability assigned. */ public function test_no_webservice_access(): void { global $DB; $context = context_course::instance($this->course->id); - $studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student']); - role_assign($studentroleid, $this->user->id, $context->id); + $teacherroleid = $DB->get_field('role', 'id', ['shortname' => 'teacher']); + role_assign($teacherroleid, $this->user->id, $context->id); $this->getDataGenerator()->enrol_user($this->user->id, $this->course->id); $this->expectException(required_capability_exception::class); $this->expectExceptionMessage('you do not currently have permissions to do that (Add new questions).'); -- GitLab