Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] Add test for unlocking project space file #7698

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we already have coverage for locking project space file?

Copy link
Member Author

@nabim777 nabim777 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to search but could not find so I think there is no coverage for locking and unlocking project spaces

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I would suggest adding locking and unlocking tests

Copy link
Contributor

@SwikritiT SwikritiT Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is some coverage for locking the project space file

Scenario Outline: lock a file in the project space

Scenario Outline: lock a file in the project space using file-id

Scenario: viewer cannot lock a file in the project space

For the first batch of lock/unlock tests IMO we can shift the tests from core to ocis and provide the coverage for unlock as per there is coverage for locking and other edge cases can be added later or in other PR

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