Skip to content

Commit ae9ceef

Browse files
add user sync tests
1 parent 11699dd commit ae9ceef

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

tests/acceptance/features/bootstrap/UserLdapGeneralContext.php

+15
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,21 @@ public function theLdapUsersHaveBeenResynced() {
142142
}
143143
}
144144

145+
/**
146+
* @When LDAP user :user is resynced
147+
*
148+
* @throws Exception
149+
* @return void
150+
*/
151+
public function ldapUserIsSynced($user) {
152+
$occResult = SetupHelper::runOcc(
153+
['user:sync', 'OCA\User_LDAP\User_Proxy', '-u', $user, '-m', 'remove']
154+
);
155+
if ($occResult['code'] !== "0") {
156+
throw new \Exception("could not sync LDAP user {$user} " . $occResult['stdErr']);
157+
}
158+
}
159+
145160
/**
146161
* @When the administrator sets the ldap attribute :attribute of the entry :entry to :value
147162
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@cli
2+
Feature: sync a user using occ command
3+
4+
As an administrator
5+
I want to be able to sync a user via the command line
6+
So that I can easily manage users when user LDAP is enabled
7+
8+
Scenario: admin deletes ldap users and syncs only one of them
9+
When the administrator deletes user "user0" using the occ command
10+
And the administrator deletes user "user1" using the occ command
11+
Then user "user0" should not exist
12+
And user "user1" should not exist
13+
When LDAP user "user0" is resynced
14+
Then user "user0" should exist
15+
And user "user1" should not exist
16+
17+
Scenario: admin edits ldap users email and syncs only one of them
18+
When the administrator changes the email of user "user0" to "[email protected]" using the occ command
19+
And the administrator changes the email of user "user1" to "[email protected]" using the occ command
20+
Then user "user0" should exist
21+
And user "user1" should exist
22+
When LDAP user "user0" is resynced
23+
Then the email address of user "user0" should be "[email protected]"
24+
And the email address of user "user1" should be "[email protected]"
25+
26+
Scenario: admin lists all the enabled backends
27+
When the admin lists the enabled user backends using the occ command
28+
Then the command should have been successful
29+
And the command output should be:
30+
"""
31+
OC\User\Database
32+
OCA\User_LDAP\User_Proxy
33+
"""

0 commit comments

Comments
 (0)