Skip to content

Commit

Permalink
adding test for trying to enable sync with invalid remote item id
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajacharya2 committed Apr 22, 2024
1 parent 520aa9a commit 5be52e2
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,40 @@ Feature: enable or disable sync of incoming shares
| resource |
| textfile0.txt |
| FolderToShare |

@issue-8724
Scenario: try to enable share sync of non-existing resource
When user "Brian" tries to enable share sync of non-existing 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": "mounting share failed"
}
}
}
}
}
"""
41 changes: 41 additions & 0 deletions tests/acceptance/features/apiSharingNg/listPermissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1079,3 +1079,44 @@ Feature: List a sharing permissions
| drive |
| Personal |
| Shares |


Scenario: try to lists the permissions of a project drive as a viewer
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
When user "Brian" tries to lists the permissions of space "new-space" 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": {
"type":"pattern"
"enum": "stat: error: not found: ^%file_id_pattern%$"
}
}
}
}
}
"""
45 changes: 45 additions & 0 deletions tests/acceptance/features/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,31 @@ public function userListsThePermissionsOfSpaceUsingTheGraphApi($user, $space):vo
);
}

/**
* @When user :user tries to lists the permissions of space :space using the Graph API
*/
public function userTriesToListsThePermissionsOfSpaceUsingTheGraphApi(string $user, string $space)
{
$spaceId = ($this->spacesContext->getSpaceByName($this->featureContext->getAdminUsername(), $space))["id"];

var_dump($spaceId,'a');

$itemId = $this->spacesContext->getResourceId("alice", $space,"");
var_dump($itemId,'b');

$this->featureContext->setResponse(
GraphHelper::getPermissionsList(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$spaceId,
$itemId
)
);
}


/**
* @param string $user
* @param TableNode $table
Expand Down Expand Up @@ -714,6 +739,26 @@ public function userEnablesSyncOfShareUsingTheGraphApi(string $user, string $sha
$this->featureContext->setResponse($response);
}

/**
* @When user :user tries to enable share sync of non-existing resource using the Graph API
*
* @param string $user
*
* @return void
*/
public function userTriesToEnablsShareSyncOfNonExistingResourceUsingTheGraphApi(string $user):void {
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
$response = GraphHelper::enableShareSync(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
WebDavHelper::generateUUIDv4(),
$shareSpaceId
);
$this->featureContext->setResponse($response);
}

/**
* @Then /^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/
*
Expand Down

0 comments on commit 5be52e2

Please sign in to comment.