diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-11-28 00:49:31 +0000 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-11-28 00:49:31 +0000 |
commit | 211955bef84071b025e83bdeeefe496a5002fdd8 (patch) | |
tree | db497735770bfa06b2d7a5f5a09e5b98faf10f47 /lib | |
parent | ed6bf75f5a78a346e3c3192b2bab79450e206598 (diff) | |
download | rpg-211955bef84071b025e83bdeeefe496a5002fdd8.tar.gz rpg-211955bef84071b025e83bdeeefe496a5002fdd8.tar.bz2 |
test import against auth plugin which doesn't allow adding users
Diffstat (limited to 'lib')
-rw-r--r-- | lib/plugins/usermanager/_test/csv_import.test.php | 18 | ||||
-rw-r--r-- | lib/plugins/usermanager/_test/mocks.class.php | 7 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/plugins/usermanager/_test/csv_import.test.php b/lib/plugins/usermanager/_test/csv_import.test.php index 5deb201ba..1f0ee7436 100644 --- a/lib/plugins/usermanager/_test/csv_import.test.php +++ b/lib/plugins/usermanager/_test/csv_import.test.php @@ -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 diff --git a/lib/plugins/usermanager/_test/mocks.class.php b/lib/plugins/usermanager/_test/mocks.class.php index edf5438b2..f3cc72c27 100644 --- a/lib/plugins/usermanager/_test/mocks.class.php +++ b/lib/plugins/usermanager/_test/mocks.class.php @@ -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; + } + +} |