mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-20 20:44:51 -04:00
[full-ci] [tests-only] Add test for disable sync with non-existing resource (#8992)
* Added tests for disabling share sync of non-existent resource * Added tests for disabling share sync with empty resource id * Added tests for disabling share sync with not shared resource id * Changed status code as expected * Added issue tag
This commit is contained in:
@@ -641,3 +641,116 @@ Feature: enable or disable sync of incoming shares
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@issue-9001
|
||||
Scenario: try to disable share sync of a non-existent resource
|
||||
When user "Brian" tries to disable share sync of a resource "nonexistent" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["error"],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"innererror",
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"code" : {
|
||||
"const": "itemNotFound"
|
||||
},
|
||||
"innererror" : {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"date",
|
||||
"request-id"
|
||||
]
|
||||
},
|
||||
"message" : {
|
||||
"const": "error getting received share"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: try to disable share sync with empty resource id
|
||||
When user "Brian" tries to disable share sync of a resource "" using the Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["error"],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"innererror",
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"code" : {
|
||||
"const": "invalidRequest"
|
||||
},
|
||||
"innererror" : {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"date",
|
||||
"request-id"
|
||||
]
|
||||
},
|
||||
"message" : {
|
||||
"const": "invalid driveID or itemID"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: try to disable share sync with not shared resource id
|
||||
Given user "Alice" has uploaded file with content "some data" to "/fileNotShared.txt"
|
||||
And we save it into "FILEID"
|
||||
When user "Brian" tries to disable share sync of a resource "<<FILEID>>" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["error"],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
"innererror",
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"code" : {
|
||||
"const": "itemNotFound"
|
||||
},
|
||||
"innererror" : {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"date",
|
||||
"request-id"
|
||||
]
|
||||
},
|
||||
"message" : {
|
||||
"const": "error getting received share"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -1188,6 +1188,30 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to disable share sync of a resource :resource using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
*/
|
||||
public function userTriesToDisableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource):void {
|
||||
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
|
||||
$shareID = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource;
|
||||
$itemId = $shareSpaceId . '!' . $shareID;
|
||||
$response = GraphHelper::disableShareSync(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$itemId,
|
||||
$shareSpaceId
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user