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 some more flexible provisioning API tests for getUsers #37882

Merged
merged 1 commit into from
Sep 14, 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
10 changes: 9 additions & 1 deletion tests/acceptance/features/apiProvisioning-v1/getUsers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: get users
Background:
Given using OCS API version "1"

@smokeTest
@smokeTest @notToImplementOnOCIS
Scenario: admin gets all users
Given user "brand-new-user" has been created with default attributes and skeleton files
When the administrator gets the list of all users using the provisioning API
Expand All @@ -17,6 +17,14 @@ Feature: get users
| brand-new-user |
| admin |

Scenario: admin gets all users
Given user "brand-new-user" has been created with default attributes and skeleton files
When the administrator gets the list of all users using the provisioning API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the users returned by the API should include
| brand-new-user |

@smokeTest @notToImplementOnOCIS
Scenario: subadmin gets the users in their group
Given these users have been created with default attributes and skeleton files:
Expand Down
10 changes: 9 additions & 1 deletion tests/acceptance/features/apiProvisioning-v2/getUsers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: get users
Background:
Given using OCS API version "2"

@smokeTest
@smokeTest @notToImplementOnOCIS
Scenario: admin gets all users
Given user "brand-new-user" has been created with default attributes and skeleton files
When the administrator gets the list of all users using the provisioning API
Expand All @@ -17,6 +17,14 @@ Feature: get users
| brand-new-user |
| admin |

Scenario: admin gets all users
Given user "brand-new-user" has been created with default attributes and skeleton files
When the administrator gets the list of all users using the provisioning API
Then the OCS status code should be "200"
And the HTTP status code should be "200"
And the users returned by the API should include
| brand-new-user |

@smokeTest @notToImplementOnOCIS
Scenario: subadmin gets the users in their group
Given these users have been created with default attributes and skeleton files:
Expand Down
29 changes: 29 additions & 0 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -3159,6 +3159,7 @@ public function adminHasDisabledUserUsingTheProvisioningApi($user) {
$user = $this->getActualUsername($user);
$this->disableOrEnableUser($this->getAdminUsername(), $user, 'disable');
$this->theHTTPStatusCodeShouldBeSuccess();
$this->ocsContext->assertOCSResponseIndicatesSuccess();
}

/**
Expand Down Expand Up @@ -3611,6 +3612,34 @@ function ($user) {
);
}

/**
* @Then /^the users returned by the API should include$/
*
* @param TableNode $usersList
*
* @return void
*/
public function theUsersShouldInclude($usersList) {
$this->verifyTableNodeColumnsCount($usersList, 1);
$users = $usersList->getRows();
$usersSimplified = \array_map(
function ($user) {
return $this->getActualUsername($user);
},
$this->simplifyArray($users)
);
$respondedArray = $this->getArrayOfUsersResponded($this->response);
foreach ($usersSimplified as $userElement) {
Assert::assertContains(
$userElement,
$respondedArray,
__METHOD__
. " user $userElement is not present in the users list: \n"
. \join("\n", $respondedArray)
);
}
}

/**
* @Then /^the groups returned by the API should be$/
*
Expand Down