Skip to content
Snippets Groups Projects
Commit 211955be authored by Christopher Smith's avatar Christopher Smith
Browse files

test import against auth plugin which doesn't allow adding users

parent ed6bf75f
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ class plugin_usermanager_csv_import_test extends DokuWikiTest {
global $auth;
$before_users = $auth->retrieveUsers();
io_savefile($this->importfile, $importCsv);
io_savefile($this->importfile, $importCsv);
$result = $this->usermanager->tryImport();
$after_users = $auth->retrieveUsers();
......@@ -66,6 +66,22 @@ class plugin_usermanager_csv_import_test extends DokuWikiTest {
$this->assertEquals($expectedFailures, $this->usermanager->getImportFailures()); // failures as expected
}
function test_cantImport(){
global $auth;
$oldauth = $auth;
$auth = new auth_mock_authplain();
$auth->setCanDo('addUser', false);
$csv = 'User,"Real Name",Email,Groups
importuser,"Ford Prefect",ford@example.com,user
';
$this->doImportTest($csv, false, array(), array());
$auth = $oldauth;
}
function test_import() {
$csv = 'User,"Real Name",Email,Groups
importuser,"Ford Prefect",ford@example.com,user
......
......@@ -41,3 +41,10 @@ class admin_mock_usermanager extends admin_plugin_usermanager {
}
}
class auth_mock_authplain extends auth_plugin_authplain {
public function setCanDo($op, $canDo) {
$this->cando[$op] = $canDo;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment