Skip to content

Commit

Permalink
tests: adddress reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Nov 24, 2023
1 parent 4bc4fdf commit 9bc7a98
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/acceptance/features/apiLocks/unlockFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Feature: unlock locked items
| timeout | Second-3600 |
When user "Alice" unlocks the last created lock of file "textfile.txt" using file-id path "<dav-path>" using the WebDAV API
Then the HTTP status code should be "204"
And 0 locks should be reported for file "textfile.txt" inside the space "Project" of user "Alice" by the WebDAV API
And 0 locks should be reported for file "textfile.txt" inside the space "Project" of user "Alice"
And user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "textfile.txt"
Examples:
| dav-path |
Expand All @@ -265,8 +265,8 @@ Feature: unlock locked items
| timeout | Second-3600 |
When user "Brian" unlocks the last created lock of file "textfile.txt" using file-id path "<dav-path>" using the WebDAV API
Then the HTTP status code should be "204"
And 0 locks should be reported for file "textfile.txt" inside the space "Personal" of user "Alice" by the WebDAV API
And 0 locks should be reported for file "textfile.txt" inside the space "Shares" of user "Brian" by the WebDAV API
And 0 locks should be reported for file "textfile.txt" inside the space "Personal" of user "Alice"
And 0 locks should be reported for file "textfile.txt" inside the space "Shares" of user "Brian"
And user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "textfile.txt"
And using new DAV path
And user "Brian" should be able to upload file "filesForUpload/lorem.txt" to "Shares/textfile.txt"
Expand Down
25 changes: 20 additions & 5 deletions tests/acceptance/features/bootstrap/WebDavLockingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,26 @@ public function userTriesToLockFileSettingPropertiesUsingWebDavAPI(string $user,
* @param TableNode $properties table with no heading with | property | value |
*
* @return void
* @throws GuzzleException
*/
public function userLocksFileInProjectSpaceUsingWebDavAPI(string $user, string $file, string $space, TableNode $properties) {
$this->featureContext->setResponse($this->userLocksFileInProjectSpace($user, $file, $space, $properties));
}

/**
* @param string $user
* @param string $file
* @param string $space
* @param TableNode $properties
*
* @return ResponseInterface|null
*
* @throws GuzzleException
*/
public function userLocksFileInProjectSpace(string $user, string $file, string $space, TableNode $properties): ?ResponseInterface {
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
$fullUrl = $this->featureContext->getBaseUrl() . '/dav/spaces/' . $spaceId . '/' . $file;
$response = $this->lockFile($user, $file, $properties, $fullUrl);
$this->featureContext->setResponse($response);
return $this->lockFile($user, $file, $properties, $fullUrl);
}

/**
Expand All @@ -183,10 +197,11 @@ public function userLocksFileInProjectSpaceUsingWebDavAPI(string $user, string $
* @param TableNode $properties table with no heading with | property | value |
*
* @return void
* @throws GuzzleException
*/
public function userHasLockedFileInProjectSpaceUsingWebDavAPI(string $user, string $file, string $space, TableNode $properties): void {
$this->userLocksFileInProjectSpaceUsingWebDavAPI($user, $file, $space, $properties);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '');
$response = $this->userLocksFileInProjectSpace($user, $file, $space, $properties);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
}

/**
Expand Down Expand Up @@ -886,7 +901,7 @@ public function waitForCertainSecondsToExpireTheLock(int $time): void {
}

/**
* @Then :count locks should be reported for file :file inside the space :space of user :user by the WebDAV API
* @Then :count locks should be reported for file :file inside the space :space of user :user
*
* @param int $count
* @param string $file
Expand Down

0 comments on commit 9bc7a98

Please sign in to comment.