Commit 5438ea02 authored by TravisCarden's avatar TravisCarden

By TravisCarden: Added a run-tests script and test coverage for Checklists report access control.

parent c4c795ab
#!/usr/bin/env sh
# @file
# This script runs automated tests for Checklist API module.
# Usage: $ ./run-tests.sh [web-server-shell-user] (defaults to "www-data")
# e.g., $ ./run-tests.sh
# or $ ./run-tests.sh apache
server_user=${1:-www-data}
drush test-run ChecklistapiUnitTestCase,ChecklistapiWebTestCase sudo -u ${server_user}
......@@ -87,7 +87,7 @@ class ChecklistapiWebTestCase extends DrupalWebTestCase {
*/
public function setUp() {
parent::setUp('checklistapi_example');
$permissions = array('edit any checklistapi checklist');
$permissions = array('edit any checklistapi checklist', 'view checklistapi checklists report');
$this->privilegedUser = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->privilegedUser);
}
......@@ -110,6 +110,20 @@ class ChecklistapiWebTestCase extends DrupalWebTestCase {
$this->assertResponse(403, 'Denied access to nonprivileged user.');
}
/**
* Test report access.
*/
public function testAccessReport() {
$report_path = 'admin/reports/checklistapi';
$this->drupalGet($report_path);
$this->assertResponse(200, 'Granted access to user with "view checklistapi checklists report" permission.');
$this->drupalLogout();
$this->drupalGet($report_path);
$this->assertResponse(403, 'Denied access to nonprivileged user.');
}
/**
* Test checklist composition.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment