diff --git a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php index 740edaf5d..2393b18d0 100644 --- a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php +++ b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php @@ -142,6 +142,21 @@ public function theLdapUsersHaveBeenResynced() { } } + /** + * @When LDAP user :user is resynced + * + * @throws Exception + * @return void + */ + public function ldapUserIsSynced($user) { + $occResult = SetupHelper::runOcc( + ['user:sync', 'OCA\User_LDAP\User_Proxy', '-u', $user, '-m', 'remove'] + ); + if ($occResult['code'] !== "0") { + throw new \Exception("could not sync LDAP user {$user} " . $occResult['stdErr']); + } + } + /** * @When the administrator sets the ldap attribute :attribute of the entry :entry to :value * diff --git a/tests/acceptance/features/cliProvisioning/userSync.feature b/tests/acceptance/features/cliProvisioning/userSync.feature new file mode 100644 index 000000000..538ca149f --- /dev/null +++ b/tests/acceptance/features/cliProvisioning/userSync.feature @@ -0,0 +1,33 @@ +@cli +Feature: sync a user using occ command + + As an administrator + I want to be able to sync a user via the command line + So that I can easily manage users when user LDAP is enabled + + Scenario: admin deletes ldap users and syncs only one of them + When the administrator deletes user "user0" using the occ command + And the administrator deletes user "user1" using the occ command + Then user "user0" should not exist + And user "user1" should not exist + When LDAP user "user0" is resynced + Then user "user0" should exist + And user "user1" should not exist + + Scenario: admin edits ldap users email and syncs only one of them + When the administrator changes the email of user "user0" to "user0@example0.com" using the occ command + And the administrator changes the email of user "user1" to "user1@example1.com" using the occ command + Then user "user0" should exist + And user "user1" should exist + When LDAP user "user0" is resynced + Then the email address of user "user0" should be "user0@example.org" + And the email address of user "user1" should be "user1@example1.com" + + Scenario: admin lists all the enabled backends + When the admin lists the enabled user backends using the occ command + Then the command should have been successful + And the command output should be: + """ + OC\User\Database + OCA\User_LDAP\User_Proxy + """ \ No newline at end of file diff --git a/tests/acceptance/features/cliProvisioning/users.feature b/tests/acceptance/features/cliProvisioning/users.feature index 6eade8786..f2e614a9e 100644 --- a/tests/acceptance/features/cliProvisioning/users.feature +++ b/tests/acceptance/features/cliProvisioning/users.feature @@ -91,3 +91,4 @@ Feature: add a user using the using the occ command #| email | ldapuser@oc.com| | email | occuser@oc.com| +