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] Added ldapAttributesForUserSearch in setConfig.sh #560

Merged
merged 5 commits into from
May 25, 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
4 changes: 2 additions & 2 deletions .drone.starlark
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ def javascript():
if params['coverage']:
result['steps'].append({
'name': 'codecov-js',
'image': 'plugins/codecov:2',
'image': 'plugins/codecov:latest',
'pull': 'always',
'settings': {
'paths': [
Expand Down Expand Up @@ -1521,7 +1521,7 @@ def phptests(testType):
if params['coverage']:
result['steps'].append({
'name': 'codecov-upload',
'image': 'plugins/codecov:2',
'image': 'plugins/codecov:latest',
'pull': 'always',
'settings': {
'paths': [
Expand Down
15 changes: 9 additions & 6 deletions tests/acceptance/features/bootstrap/UserLdapGeneralContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ public function ldapUserIsSynced($user) {
['user:sync', 'OCA\User_LDAP\User_Proxy', '-u', $user, '-m', 'remove']
);
if ($this->featureContext->getExitStatusCodeOfOccCommand() !== 0) {
throw new \Exception("could not sync LDAP user {$user} " . $occResult['stdErr']);
throw new \Exception(
"could not sync LDAP user {$user} " .
$this->featureContext->getStdErrOfOccCommand()
);
}
}

Expand All @@ -148,7 +151,7 @@ public function ldapUserIsSynced($user) {
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 Expand Up @@ -209,7 +212,7 @@ public function theLdapAttributeOfTheEntryToContentOfFile(
$attribute, $entry, $filename
) {
$value = \file_get_contents(\getenv("FILES_FOR_UPLOAD") . $filename);

$this->setTheLdapAttributeOfTheEntryTo(
$attribute, $entry, $value
);
Expand Down Expand Up @@ -306,12 +309,12 @@ public function createLDAPUsers($amount, $prefix, $ou) {
$ldap->add($ouDN, $entry);
$this->featureContext->setToDeleteDNs($ouDN);
}

$lenOfSuffix = \strlen((string)$amount);
for ($i = 0; $i < $amount; $i++) {
$uid = $prefix . \str_pad($i, $lenOfSuffix, '0', STR_PAD_LEFT);
$newDN = 'uid=' . $uid . ',ou=' . $ou . ',' . $this->featureContext->getLdapBaseDN();

$entry = [];
$entry['cn'] = $uid;
$entry['sn'] = $i;
Expand All @@ -322,7 +325,7 @@ public function createLDAPUsers($amount, $prefix, $ou) {
$entry['displayName'] = $uid;
$entry['gidNumber'] = 5000;
$entry['uidNumber'] = $maxUidNumber + $i + 1;

$ldap->add($newDN, $entry);
$this->featureContext->addUserToCreatedUsersList(
$uid, $uid, $uid, null, false
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/cliProvisioning/userSync.feature
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ Feature: sync user using occ command
And the display name of user "regular" should be "Regular User"

@issue-515
@skipOnOcV10.3 @skipOnOcV10.4
Scenario: sync a user that does not exist
When LDAP user "regularuser" is resynced
Then the command should have been successful
And the command output should be:
"""
Syncing regularuser ...
Searching for regularuser ...
Exact match for user regularuser not found in the backend.
Deleting accounts:
regularuser, , (no longer exists in the backend)
"""
3 changes: 2 additions & 1 deletion tests/acceptance/setConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ configID="LDAPTestId"
./occ ldap:set-config "$configID" ldapUuidUserAttribute "auto"
./occ ldap:set-config "$configID" turnOffCertCheck "0"
./occ ldap:set-config "$configID" useMemberOfToDetectMembership "1"
./occ ldap:set-config "$configID" ldapConfigurationActive "1"
./occ ldap:set-config "$configID" ldapConfigurationActive "1"
./occ ldap:set-config "$configID" ldapAttributesForUserSearch "uid"