Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests-Only] Add user sync tests #497

Merged
merged 1 commit into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/acceptance/features/bootstrap/UserLdapGeneralContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,33 @@ public function ldapConfigHasTheseSettings($configId, TableNode $table) {
}
}

/**
* @When LDAP user :user is resynced
*
* @param string $user
*
* @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 admin lists the enabled user backends using the occ command
*
* @return void
* @throws Exception
*/
public function theAdminListsTheEnabledBackendsUsingTheOccCommand() {
$this->featureContext->runOcc(["user:sync -l"]);
}

/**
* @When the administrator sets the ldap attribute :attribute of the entry :entry to :value
*
Expand Down
41 changes: 41 additions & 0 deletions tests/acceptance/features/cliProvisioning/userSync.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@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

Background:
Given these users have been created with default attributes and without skeleton files:
| username |
| user0 |
| user1 |

@skipOnOcV10.3
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

@skipOnOcV10.3
Scenario: admin edits ldap users email and syncs only one of them
When the administrator changes the email of user "user0" to "[email protected]" using the occ command
And the administrator changes the email of user "user1" to "[email protected]" 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 "[email protected]"
And the email address of user "user1" should be "[email protected]"

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
"""