Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
211955be
Commit
211955be
authored
11 years ago
by
Christopher Smith
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/plugins/usermanager/_test/csv_import.test.php
+17
-1
17 additions, 1 deletion
lib/plugins/usermanager/_test/csv_import.test.php
lib/plugins/usermanager/_test/mocks.class.php
+7
-0
7 additions, 0 deletions
lib/plugins/usermanager/_test/mocks.class.php
with
24 additions
and
1 deletion
lib/plugins/usermanager/_test/csv_import.test.php
+
17
−
1
View file @
211955be
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
lib/plugins/usermanager/_test/mocks.class.php
+
7
−
0
View file @
211955be
...
...
@@ -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
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment