Skip to content

Commit

Permalink
ci-again - Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EJMFarrow authored and sangwinc committed Jan 21, 2025
1 parent 08d73d1 commit dd7ece1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/library_import_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public function test_not_logged_in(): void {
}

/**
* 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).');
Expand Down
6 changes: 3 additions & 3 deletions tests/library_render_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ public function test_not_logged_in(): void {
}

/**
* 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).');
Expand Down

0 comments on commit dd7ece1

Please sign in to comment.