Skip to content

Commit e4d58d3

Browse files
committed
test: Add integration tests for getting user and mail collaborators
The OCS endpoint expects either an int or an array for "shareType". However, when using "getRowsHash()" only a single key is taken into account, so instead of: | shareType[] | 0 | | shareType[] | 4 | the share types are provided in a single row like: | shareTypes | 0 4 | and then converted to "shareType[]=0&shareType[]=4" when sending the request. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
1 parent e68e5c3 commit e4d58d3

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

build/integration/features/bootstrap/Sharing.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,13 @@ public function whenGettingShareesFor($body) {
697697
if ($body instanceof TableNode) {
698698
$parameters = [];
699699
foreach ($body->getRowsHash() as $key => $value) {
700-
$parameters[] = $key . '=' . $value;
700+
if ($key === 'shareTypes') {
701+
foreach (explode(' ', $value) as $shareType) {
702+
$parameters[] = 'shareType[]=' . $shareType;
703+
}
704+
} else {
705+
$parameters[] = $key . '=' . $value;
706+
}
701707
}
702708
if (!empty($parameters)) {
703709
$url .= '?' . implode('&', $parameters);

build/integration/sharees_features/sharees.feature

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,3 +445,42 @@ Feature: sharees
445445
And "exact emails" sharees returned are
446446
| sharee2@secondary.c | 4 | sharee2@secondary.c |
447447
And "emails" sharees returned is empty
448+
449+
Scenario: Search user and e-mail matching system e-mail address of user
450+
Given As an "test"
451+
When getting sharees for
452+
| search | sharee2@system.com |
453+
| itemType | file |
454+
| shareTypes | 0 4 |
455+
Then the OCS status code should be "100"
456+
And the HTTP status code should be "200"
457+
# UserPlugin provides two identical results (except for the field order, but
458+
# that is hidden by the check)
459+
And "exact users" sharees returned are
460+
| Sharee2 | 0 | Sharee2 | sharee2@system.com |
461+
| Sharee2 | 0 | Sharee2 | sharee2@system.com |
462+
And "users" sharees returned is empty
463+
And "exact groups" sharees returned is empty
464+
And "groups" sharees returned is empty
465+
And "exact remotes" sharees returned is empty
466+
And "remotes" sharees returned is empty
467+
And "exact emails" sharees returned is empty
468+
And "emails" sharees returned is empty
469+
470+
Scenario: Search user and e-mail matching secondary e-mail address of user
471+
Given As an "test"
472+
When getting sharees for
473+
| search | sharee2@secondary.com |
474+
| itemType | file |
475+
| shareTypes | 0 4 |
476+
Then the OCS status code should be "100"
477+
And the HTTP status code should be "200"
478+
And "exact users" sharees returned are
479+
| Sharee2 (sharee2@secondary.com) | 0 | Sharee2 | sharee2@secondary.com |
480+
And "users" sharees returned is empty
481+
And "exact groups" sharees returned is empty
482+
And "groups" sharees returned is empty
483+
And "exact remotes" sharees returned is empty
484+
And "remotes" sharees returned is empty
485+
And "exact emails" sharees returned is empty
486+
And "emails" sharees returned is empty

0 commit comments

Comments
 (0)