From ff8573d5d38148f58f03d079a2352515c5404545 Mon Sep 17 00:00:00 2001 From: Kiran Parajuli Date: Mon, 17 Feb 2020 12:20:27 +0545 Subject: [PATCH] Added acceptance test for user:sync with non-existing user --- .../features/bootstrap/UserLdapGeneralContext.php | 4 ++-- .../features/cliProvisioning/userSync.feature | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php index 1c26230da..4c7473c52 100644 --- a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php +++ b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php @@ -131,10 +131,10 @@ public function ldapConfigHasTheseSettings($configId, TableNode $table) { * @return void */ public function ldapUserIsSynced($user) { - $occResult = SetupHelper::runOcc( + $this->featureContext->runOcc( ['user:sync', 'OCA\User_LDAP\User_Proxy', '-u', $user, '-m', 'remove'] ); - if ($occResult['code'] !== "0") { + if ($this->featureContext->getExitStatusCodeOfOccCommand() !== 0) { throw new \Exception("could not sync LDAP user {$user} " . $occResult['stdErr']); } } diff --git a/tests/acceptance/features/cliProvisioning/userSync.feature b/tests/acceptance/features/cliProvisioning/userSync.feature index 94ae896a5..10160e565 100644 --- a/tests/acceptance/features/cliProvisioning/userSync.feature +++ b/tests/acceptance/features/cliProvisioning/userSync.feature @@ -82,3 +82,15 @@ Feature: sync user using occ command And user "regularuser" should exist And the display name of user "regularuser" should be "Test User" And the display name of user "regular" should be "Regular User" + + @issue-515 + Scenario: sync a user that does not exist + Given user "regularuser" should not exist + When LDAP user "regularuser" is resynced + Then the command should have been successful + And the command output should be: + """ + Syncing regularuser ... + Deleting accounts: + regularuser, , (no longer exists in the backend) + """