Skip to content

Commit

Permalink
add test for unlocking project space file (#7698)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabim777 authored Nov 21, 2023
1 parent 214d127 commit 111dbb3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/acceptance/features/apiLocks/unlockFiles.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: unlock locked items
As a user
I want to unlock the resources previously locked by myself
So that other users can make changes to the resources

Background:
Given user "Alice" has been created with default attributes and without skeleton files

@issue-7696
Scenario Outline: unlock a locked file in project space
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 "project-space" with the default quota using the Graph API
And user "Alice" has uploaded a file inside space "project-space" with content "some data" to "textfile.txt"
And user "Alice" has locked file "textfile.txt" inside space "project-space" setting the following properties
| lockscope | <lock-scope> |
When user "Alice" unlocks the last created lock of file "textfile.txt" inside space "project-space" using the WebDAV API
Then the HTTP status code should be "204"
Examples:
| lock-scope |
| shared |
| exclusive |
36 changes: 36 additions & 0 deletions tests/acceptance/features/bootstrap/WebDavLockingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,22 @@ public function userHasLockedFile(string $user, string $file, TableNode $propert
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
}

/**
* @Given user :user has locked file :file inside space :spaceName setting the following properties
*
* @param string $user
* @param string $file
* @param string $spaceName
* @param TableNode $properties table with no heading with | property | value |
*
* @return void
*/
public function userHasLockedFileInsideSpaceSettingTheFollowingProperties(string $user, string $file, string $spaceName, TableNode $properties) {
$this->spacesContext->setSpaceIDByName($this->featureContext->getActualUsername($user), $spaceName);
$response = $this->lockFile($user, $file, $properties);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
}

/**
* @Given user :user has locked file :file using file-id path :path setting the following properties
*
Expand Down Expand Up @@ -355,6 +371,26 @@ public function unlockLastLockUsingWebDavAPI(string $user, string $file) {
$this->featureContext->setResponse($response);
}

/**
* @When user :user unlocks the last created lock of file :file inside space :spaceName using the WebDAV API
*
* @param string $user
* @param string $spaceName
* @param string $file
*
* @return void
*/
public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi(string $user, string $spaceName, string $file) {
$this->spacesContext->setSpaceIDByName($this->featureContext->getActualUsername($user), $spaceName);
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
$user,
$file,
$user,
$file
);
$this->featureContext->setResponse($response);
}

/**
* @When user :user unlocks file :itemToUnlock with the last created lock of file :itemToUseLockOf using the WebDAV API
*
Expand Down

0 comments on commit 111dbb3

Please sign in to comment.