mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 01:10:20 -06:00
Merge pull request #9639 from owncloud/cli-remove-file-versions-by-spaceid
[tests-only][full-ci] adding test to remove old versions of files from a space using space-id using CLI
This commit is contained in:
@@ -168,6 +168,24 @@ class CliContext implements Context {
|
||||
$this->featureContext->setResponse(CliHelper::runCommand($body));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator removes the file versions of space :space using the CLI
|
||||
*
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theAdministratorRemovesTheVersionsOfFilesInSpaceUsingSpaceId(string $space):void {
|
||||
$path = $this->featureContext->getStorageUsersRoot();
|
||||
$adminUsername = $this->featureContext->getAdminUsername();
|
||||
$spaceId = $this->spacesContext->getSpaceIdByName($adminUsername, $space);
|
||||
$command = "revisions purge -p $path -r $spaceId --dry-run=false";
|
||||
$body = [
|
||||
"command" => $command
|
||||
];
|
||||
$this->featureContext->setResponse(CliHelper::runCommand($body));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the command should be successful
|
||||
*
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
@env-config
|
||||
Feature: remove file versions via CLI command
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
|
||||
|
||||
Scenario: remove all file versions
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And user "Alice" has uploaded file with content "This is version 1" to "textfile.txt"
|
||||
Given user "Alice" has uploaded file with content "This is version 1" to "textfile.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 2" to "textfile.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 3" to "textfile.txt"
|
||||
When the administrator removes all the file versions using the CLI
|
||||
@@ -16,8 +18,7 @@ Feature: remove file versions via CLI command
|
||||
|
||||
|
||||
Scenario: remove all versions of file using file-id
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And user "Alice" has uploaded file with content "This is version 1" to "randomFile.txt"
|
||||
Given user "Alice" has uploaded file with content "This is version 1" to "randomFile.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 2" to "randomFile.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 3" to "randomFile.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 1" to "anotherFile.txt"
|
||||
@@ -32,3 +33,32 @@ Feature: remove file versions via CLI command
|
||||
When user "Alice" gets the number of versions of file "anotherFile.txt"
|
||||
Then the HTTP status code should be "207"
|
||||
And the number of versions should be "2"
|
||||
|
||||
|
||||
Scenario: remove all versions of files from a space
|
||||
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And using spaces DAV path
|
||||
And user "Alice" has created a space "projectSpace" with the default quota using the Graph API
|
||||
And user "Alice" has uploaded file with content "This is version 1" to "file.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 2" to "file.txt"
|
||||
And user "Alice" has uploaded file with content "This is version 3" to "file.txt"
|
||||
And user "Alice" has uploaded a file inside space "projectSpace" with content "This is version 1" to "lorem.txt"
|
||||
And user "Alice" has uploaded a file inside space "projectSpace" with content "This is version 2" to "lorem.txt"
|
||||
And user "Alice" has uploaded a file inside space "projectSpace" with content "This is version 3" to "lorem.txt"
|
||||
And we save it into "LOREM_FILEID"
|
||||
And user "Alice" has uploaded a file inside space "projectSpace" with content "This is version 1" to "epsum.txt"
|
||||
And user "Alice" has uploaded a file inside space "projectSpace" with content "This is version 2" to "epsum.txt"
|
||||
And user "Alice" has uploaded a file inside space "projectSpace" with content "This is version 3" to "epsum.txt"
|
||||
And we save it into "EPSUM_FILEID"
|
||||
When the administrator removes the file versions of space "projectSpace" using the CLI
|
||||
Then the command should be successful
|
||||
And the command output should contain "✅ Deleted 4 revisions (12 files / 4 blobs)"
|
||||
When user "Alice" gets the number of versions of file "file.txt"
|
||||
Then the HTTP status code should be "207"
|
||||
And the number of versions should be "2"
|
||||
When user "Alice" gets the number of versions of file "lorem.txt" using file-id path "/meta/<<LOREM_FILEID>>/v"
|
||||
Then the HTTP status code should be "207"
|
||||
And the number of versions should be "0"
|
||||
When user "Alice" gets the number of versions of file "epsum.txt" using file-id path "/meta/<<EPSUM_FILEID>>/v"
|
||||
Then the HTTP status code should be "207"
|
||||
And the number of versions should be "0"
|
||||
|
||||
Reference in New Issue
Block a user