adjust ocm sharing tests
This commit is contained in:
@@ -2538,15 +2538,16 @@ class GraphContext implements Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" lists the shares shared with (?:him|her)(| after clearing user cache) using the Graph API$/
|
* @When /^user "([^"]*)" lists the shares shared with (?:him|her)(| after clearing user cache)(| without retry) using the Graph API$/
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $cacheStepString
|
* @param string $cacheStepString
|
||||||
|
* @param string $retryOption
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userListsTheResourcesSharedWithThemUsingGraphApi(string $user, string $cacheStepString): void {
|
public function userListsTheResourcesSharedWithThemUsingGraphApi(string $user, string $cacheStepString, string $retryOption): void {
|
||||||
if ($cacheStepString !== '') {
|
if ($cacheStepString !== '') {
|
||||||
// ENV (GRAPH_SPACES_GROUPS_CACHE_TTL | GRAPH_SPACES_USERS_CACHE_TTL) is set default to 60 sec
|
// ENV (GRAPH_SPACES_GROUPS_CACHE_TTL | GRAPH_SPACES_USERS_CACHE_TTL) is set default to 60 sec
|
||||||
// which means 60 sec is required to clean up all the user|group cache once they are deleted
|
// which means 60 sec is required to clean up all the user|group cache once they are deleted
|
||||||
@@ -2559,6 +2560,7 @@ class GraphContext implements Context {
|
|||||||
// Sometimes listing shares might not return the updated shares list
|
// Sometimes listing shares might not return the updated shares list
|
||||||
// so try again until @client.synchronize is true for the max. number of retries (i.e. 10)
|
// so try again until @client.synchronize is true for the max. number of retries (i.e. 10)
|
||||||
// and do not retry when the share is expected to be not synced
|
// and do not retry when the share is expected to be not synced
|
||||||
|
$retryEnabled = ($retryOption === '');
|
||||||
$tryAgain = false;
|
$tryAgain = false;
|
||||||
$retried = 0;
|
$retried = 0;
|
||||||
do {
|
do {
|
||||||
@@ -2571,17 +2573,19 @@ class GraphContext implements Context {
|
|||||||
|
|
||||||
$jsonBody = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
$jsonBody = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||||
|
|
||||||
foreach ($jsonBody->value as $share) {
|
if ($retryEnabled) {
|
||||||
$autoSync = $this->featureContext->getUserAutoSyncSetting($credentials['username']);
|
foreach ($jsonBody->value as $share) {
|
||||||
$tryAgain = !$share->{'@client.synchronize'} && $autoSync && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly();
|
$autoSync = $this->featureContext->getUserAutoSyncSetting($credentials['username']);
|
||||||
|
$tryAgain = !$share->{'@client.synchronize'} && $autoSync && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly();
|
||||||
|
|
||||||
if ($tryAgain) {
|
if ($tryAgain) {
|
||||||
$retried += 1;
|
$retried += 1;
|
||||||
echo "auto-sync share for user '$user' is enabled\n";
|
echo "auto-sync share for user '$user' is enabled\n";
|
||||||
echo "but share '$share->name' was not auto-synced, retrying ($retried)...\n";
|
echo "but share '$share->name' was not auto-synced, retrying ($retried)...\n";
|
||||||
// wait 500ms and try again
|
// wait 500ms and try again
|
||||||
\usleep(500 * 1000);
|
\usleep(500 * 1000);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ($tryAgain);
|
} while ($tryAgain);
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ class SharingNgContext implements Context {
|
|||||||
* @param string $user
|
* @param string $user
|
||||||
* @param array $shareInfo
|
* @param array $shareInfo
|
||||||
* @param string|null $fileId
|
* @param string|null $fileId
|
||||||
|
* @param bool $isFederated
|
||||||
*
|
*
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*
|
*
|
||||||
@@ -246,7 +247,7 @@ class SharingNgContext implements Context {
|
|||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function sendShareInvitation(string $user, array $shareInfo, string $fileId = null): ResponseInterface {
|
public function sendShareInvitation(string $user, array $shareInfo, string $fileId = null, $isFederated = false): ResponseInterface {
|
||||||
if ($shareInfo['space'] === 'Personal' || $shareInfo['space'] === 'Shares') {
|
if ($shareInfo['space'] === 'Personal' || $shareInfo['space'] === 'Shares') {
|
||||||
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
|
$space = $this->spacesContext->getSpaceByName($user, $shareInfo['space']);
|
||||||
} else {
|
} else {
|
||||||
@@ -282,6 +283,9 @@ class SharingNgContext implements Context {
|
|||||||
$shareeId = "";
|
$shareeId = "";
|
||||||
if ($shareType === "user") {
|
if ($shareType === "user") {
|
||||||
$shareeId = $this->featureContext->getAttributeOfCreatedUser($sharee, 'id');
|
$shareeId = $this->featureContext->getAttributeOfCreatedUser($sharee, 'id');
|
||||||
|
if ($isFederated) {
|
||||||
|
$shareeId = base64_encode($shareeId . $shareInfo['federatedServer']);
|
||||||
|
}
|
||||||
} elseif ($shareType === "group") {
|
} elseif ($shareType === "group") {
|
||||||
$shareeId = $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id');
|
$shareeId = $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id');
|
||||||
}
|
}
|
||||||
@@ -426,6 +430,24 @@ class SharingNgContext implements Context {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When /^user "([^"]*)" sends the following resource share invitation to federated user using the Graph API:$/
|
||||||
|
*
|
||||||
|
* @param string $user
|
||||||
|
* @param TableNode $table
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
|
* @throws GuzzleException
|
||||||
|
*/
|
||||||
|
public function userSendsTheFollowingResourceShareInvitationTofederatedUserUsingTheGraphApi(string $user, TableNode $table): void {
|
||||||
|
$rows = $table->getRowsHash();
|
||||||
|
Assert::assertArrayHasKey("resource", $rows, "'resource' should be provided in the data-table while sharing a resource");
|
||||||
|
$this->featureContext->setResponse(
|
||||||
|
$this->sendShareInvitation($user, $rows, null, true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" sends the following space share invitation using permissions endpoint of the Graph API:$/
|
* @When /^user "([^"]*)" sends the following space share invitation using permissions endpoint of the Graph API:$/
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -254,11 +254,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
|||||||
- [apiSpacesDavOperation/moveByFileId.feature:492](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L492)
|
- [apiSpacesDavOperation/moveByFileId.feature:492](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L492)
|
||||||
- [apiSpacesDavOperation/moveByFileId.feature:493](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L493)
|
- [apiSpacesDavOperation/moveByFileId.feature:493](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L493)
|
||||||
|
|
||||||
#### [OCM. sharing issues](https://github.com/owncloud/ocis/issues/9534)
|
|
||||||
|
|
||||||
- [apiOcm/share.feature:12](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L12)
|
|
||||||
- [apiOcm/share.feature:91](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L91)
|
|
||||||
|
|
||||||
#### [OCM. admin cannot get federated users if he hasn't connection with them ](https://github.com/owncloud/ocis/issues/9829)
|
#### [OCM. admin cannot get federated users if he hasn't connection with them ](https://github.com/owncloud/ocis/issues/9829)
|
||||||
|
|
||||||
tests/acceptance/features/apiOcm/searchFederationUsers.feature
|
tests/acceptance/features/apiOcm/searchFederationUsers.feature
|
||||||
|
|||||||
@@ -16,15 +16,16 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
And "Brian" has accepted invitation
|
And "Brian" has accepted invitation
|
||||||
And using server "LOCAL"
|
And using server "LOCAL"
|
||||||
And user "Alice" has created folder "folderToShare"
|
And user "Alice" has created folder "folderToShare"
|
||||||
When user "Alice" sends the following resource share invitation using the Graph API:
|
When user "Alice" sends the following resource share invitation to federated user using the Graph API:
|
||||||
| resource | folderToShare |
|
| resource | folderToShare |
|
||||||
| space | Personal |
|
| space | Personal |
|
||||||
| sharee | Brian |
|
| sharee | Brian |
|
||||||
| shareType | user |
|
| shareType | user |
|
||||||
| permissionsRole | Viewer |
|
| permissionsRole | Viewer |
|
||||||
|
| federatedServer | @federation-ocis-server:10200 |
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
When using server "REMOTE"
|
When using server "REMOTE"
|
||||||
And user "Brian" lists the shares shared with him using the Graph API
|
And user "Brian" lists the shares shared with him without retry using the Graph API
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
And the JSON data of the response should match
|
And the JSON data of the response should match
|
||||||
"""
|
"""
|
||||||
@@ -47,13 +48,13 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
"name"
|
"name"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"@UI.Hidden":{
|
"@UI.Hidden": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"enum": [false]
|
"enum": [false]
|
||||||
},
|
},
|
||||||
"@client.synchronize":{
|
"@client.synchronize": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"enum": [true]
|
"enum": [false]
|
||||||
},
|
},
|
||||||
"createdBy": {
|
"createdBy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -63,7 +64,10 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
"properties": {
|
"properties": {
|
||||||
"user": {
|
"user": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["displayName", "id"],
|
"required": [
|
||||||
|
"displayName",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"displayName": {
|
"displayName": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -71,7 +75,7 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "^%user_id_pattern%$"
|
"pattern": "^%federated_user_id_pattern%$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,12 +98,13 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
And using server "REMOTE"
|
And using server "REMOTE"
|
||||||
And "Brian" has accepted invitation
|
And "Brian" has accepted invitation
|
||||||
And user "Brian" has created folder "folderToShare"
|
And user "Brian" has created folder "folderToShare"
|
||||||
When user "Brian" sends the following resource share invitation using the Graph API:
|
When user "Brian" sends the following resource share invitation to federated user using the Graph API:
|
||||||
| resource | folderToShare |
|
| resource | folderToShare |
|
||||||
| space | Personal |
|
| space | Personal |
|
||||||
| sharee | Alice |
|
| sharee | Alice |
|
||||||
| shareType | user |
|
| shareType | user |
|
||||||
| permissionsRole | Viewer |
|
| permissionsRole | Viewer |
|
||||||
|
| federatedServer | @ocis-server:9200 |
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
When using server "LOCAL"
|
When using server "LOCAL"
|
||||||
And user "Alice" lists the shares shared with her using the Graph API
|
And user "Alice" lists the shares shared with her using the Graph API
|
||||||
@@ -125,11 +130,13 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
"name"
|
"name"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"@UI.Hidden":{
|
"@UI.Hidden": {
|
||||||
"const": "false"
|
"type": "boolean",
|
||||||
|
"enum": [false]
|
||||||
},
|
},
|
||||||
"@client.synchronize":{
|
"@client.synchronize": {
|
||||||
"const": "true"
|
"type": "boolean",
|
||||||
|
"enum": [false]
|
||||||
},
|
},
|
||||||
"createdBy": {
|
"createdBy": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -139,14 +146,17 @@ Feature: an user shares resources usin ScienceMesh application
|
|||||||
"properties": {
|
"properties": {
|
||||||
"user": {
|
"user": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["displayName", "id"],
|
"required": [
|
||||||
|
"displayName",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"displayName": {
|
"displayName": {
|
||||||
"const": "Brian Murphy"
|
"const": "Brian Murphy"
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "^%user_id_pattern%$"
|
"pattern": "^%federated_user_id_pattern%$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user