mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-01 01:41:21 -05:00
* removed unsed steps from Archiver and Auth contexts fix methods fix sendRequest method fix steps add missing step * move steps from OCS to Auth context add missing step fix null fix variable name fix variable name * fix password
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -522,266 +522,6 @@ class OCSContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method using password :password about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
* @param string $password
|
||||
* @param string $ofUser
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userSendsRequestToTheseEndpointsWithOutBodyUsingPassword(
|
||||
string $user,
|
||||
string $method,
|
||||
string $password,
|
||||
string $ofUser,
|
||||
TableNode $table
|
||||
):void {
|
||||
$this->userSendsRequestToTheseEndpointsWithBodyUsingPassword(
|
||||
$user,
|
||||
$method,
|
||||
null,
|
||||
$password,
|
||||
$ofUser,
|
||||
$table
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method including body :body using password :password about user :ofUser
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string|null $method
|
||||
* @param string|null $body
|
||||
* @param string|null $password
|
||||
* @param string|null $ofUser
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userSendsRequestToTheseEndpointsWithBodyUsingPassword(
|
||||
?string $user,
|
||||
?string $method,
|
||||
?string $body,
|
||||
?string $password,
|
||||
?string $ofUser,
|
||||
TableNode $table
|
||||
):void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['destination']);
|
||||
$this->featureContext->emptyLastHTTPStatusCodesArray();
|
||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
);
|
||||
$header = [];
|
||||
if (isset($row['destination'])) {
|
||||
$header['Destination'] = $this->featureContext->substituteInLineCodes(
|
||||
$this->featureContext->getBaseUrl() . $row['destination'],
|
||||
$ofUser
|
||||
);
|
||||
}
|
||||
$this->featureContext->authContext->userRequestsURLWithUsingBasicAuth(
|
||||
$user,
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
$password,
|
||||
$body,
|
||||
$header
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method including body :body about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
* @param string $body
|
||||
* @param string $ofUser
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userSendsRequestToTheseEndpointsWithBody(string $user, string $method, string $body, string $ofUser, TableNode $table):void {
|
||||
$header = [];
|
||||
if ($method === 'MOVE' || $method === 'COPY') {
|
||||
$header['Destination'] = '/path/to/destination';
|
||||
}
|
||||
|
||||
$this->sendRequestToTheseEndpointsAsNormalUser(
|
||||
$user,
|
||||
$method,
|
||||
$ofUser,
|
||||
$table,
|
||||
$body,
|
||||
null,
|
||||
$header,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user requests these endpoints with :method about user :ofUser
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
* @param string $ofUser
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userSendsRequestToTheseEndpointsWithOutBody(string $user, string $method, string $ofUser, TableNode $table):void {
|
||||
$header = [];
|
||||
if ($method === 'MOVE' || $method === 'COPY') {
|
||||
$header['Destination'] = '/path/to/destination';
|
||||
}
|
||||
|
||||
$this->sendRequestToTheseEndpointsAsNormalUser(
|
||||
$user,
|
||||
$method,
|
||||
$ofUser,
|
||||
$table,
|
||||
null,
|
||||
null,
|
||||
$header,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" requests these endpoints with "([^"]*)" to (?:get|set) property "([^"]*)" about user "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
* @param string $property
|
||||
* @param string $ofUser
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userSendsRequestToTheseEndpointsWithProperty(string $user, string $method, string $property, string $ofUser, TableNode $table):void {
|
||||
$this->sendRequestToTheseEndpointsAsNormalUser(
|
||||
$user,
|
||||
$method,
|
||||
$ofUser,
|
||||
$table,
|
||||
null,
|
||||
$property
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
* @param string $method
|
||||
* @param string $ofUser
|
||||
* @param TableNode $table
|
||||
* @param string|null $body
|
||||
* @param string|null $property
|
||||
* @param Array|null $header
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendRequestToTheseEndpointsAsNormalUser(
|
||||
string $user,
|
||||
string $method,
|
||||
string $ofUser,
|
||||
TableNode $table,
|
||||
?string $body = null,
|
||||
?string $property = null,
|
||||
?array $header = null
|
||||
):void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$ofUser = $this->featureContext->getActualUsername($ofUser);
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
$this->featureContext->emptyLastHTTPStatusCodesArray();
|
||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||
if (!$body && $property) {
|
||||
$body = $this->featureContext->getBodyForOCSRequest($method, $property);
|
||||
}
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$ofUser
|
||||
);
|
||||
$this->featureContext->authContext->userRequestsURLWithUsingBasicAuth(
|
||||
$user,
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$body,
|
||||
$header
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser requests these endpoints with :method including body :body using the password of user :user
|
||||
*
|
||||
* @param string $asUser
|
||||
* @param string $method
|
||||
* @param string|null $body
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userRequestsTheseEndpointsWithBodyUsingThePasswordOfUser(string $asUser, string $method, ?string $body, string $user, TableNode $table):void {
|
||||
$asUser = $this->featureContext->getActualUsername($asUser);
|
||||
$userRenamed = $this->featureContext->getActualUsername($user);
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
$this->featureContext->emptyLastHTTPStatusCodesArray();
|
||||
$this->featureContext->emptyLastOCSStatusCodesArray();
|
||||
foreach ($table->getHash() as $row) {
|
||||
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
|
||||
$row['endpoint'],
|
||||
$userRenamed
|
||||
);
|
||||
$this->featureContext->authContext->userRequestsURLWithUsingBasicAuth(
|
||||
$asUser,
|
||||
$row['endpoint'],
|
||||
$method,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$body
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :asUser requests these endpoints with :method using the password of user :user
|
||||
*
|
||||
* @param string $asUser
|
||||
* @param string $method
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userRequestsTheseEndpointsWithoutBodyUsingThePasswordOfUser(string $asUser, string $method, string $user, TableNode $table):void {
|
||||
$this->userRequestsTheseEndpointsWithBodyUsingThePasswordOfUser(
|
||||
$asUser,
|
||||
$method,
|
||||
null,
|
||||
$user,
|
||||
$table
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the OCS status code should be "([^"]*)"$/
|
||||
*
|
||||
|
||||
@@ -104,14 +104,14 @@ Feature: auth
|
||||
|
||||
@issue-1319
|
||||
Scenario: using OCS with admin basic auth
|
||||
When the administrator requests these endpoint with "GET"
|
||||
When the administrator requests these endpoints with "GET"
|
||||
| endpoint |
|
||||
| /ocs/v1.php/cloud/apps |
|
||||
| /ocs/v1.php/cloud/groups |
|
||||
| /ocs/v1.php/cloud/users |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
And the OCS status code of responses on all endpoints should be "100"
|
||||
When the administrator requests these endpoint with "GET"
|
||||
When the administrator requests these endpoints with "GET"
|
||||
| endpoint |
|
||||
| /ocs/v2.php/cloud/apps |
|
||||
| /ocs/v2.php/cloud/groups |
|
||||
|
||||
@@ -55,7 +55,7 @@ Feature: make webdav request with special urls
|
||||
|
||||
|
||||
Scenario: send LOCK requests to webDav endpoints with 2 slashes
|
||||
When the user "Alice" requests these endpoints with "LOCK" to get property "d:shared" with password "%regular%" about user "Alice"
|
||||
When user "Alice" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice"
|
||||
| endpoint |
|
||||
| //remote.php/webdav/textfile0.txt |
|
||||
| //remote.php//dav/files/%username%/textfile1.txt |
|
||||
@@ -66,7 +66,7 @@ Feature: make webdav request with special urls
|
||||
|
||||
|
||||
Scenario: send LOCK requests to webDav endpoints with 2 slashes using the spaces WebDAV API
|
||||
When the user "Alice" requests these endpoints with "LOCK" to get property "d:shared" with password "%regular%" about user "Alice"
|
||||
When user "Alice" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice"
|
||||
| endpoint |
|
||||
| //remote.php/dav/spaces/%spaceid%/textfile0.txt |
|
||||
| //remote.php//dav/spaces/%spaceid%/PARENT/parent.txt |
|
||||
@@ -142,7 +142,7 @@ Feature: make webdav request with special urls
|
||||
|
||||
|
||||
Scenario: send PROPFIND requests to webDav endpoints with 2 slashes
|
||||
When the user "Alice" requests these endpoints with "PROPFIND" to get property "d:href" with password "%regular%" about user "Alice"
|
||||
When user "Alice" requests these endpoints with "PROPFIND" to get property "d:href" about user "Alice"
|
||||
| endpoint |
|
||||
| //remote.php/webdav/textfile0.txt |
|
||||
| //remote.php//dav/files/%username%/textfile1.txt |
|
||||
@@ -153,7 +153,7 @@ Feature: make webdav request with special urls
|
||||
|
||||
@skipOnRevaMaster
|
||||
Scenario: send PROPFIND requests to webDav endpoints with 2 slashes using the spaces WebDAV API
|
||||
When the user "Alice" requests these endpoints with "PROPFIND" to get property "d:href" with password "%regular%" about user "Alice"
|
||||
When user "Alice" requests these endpoints with "PROPFIND" to get property "d:href" about user "Alice"
|
||||
| endpoint |
|
||||
| //remote.php//dav/spaces/%spaceid%/textfile1.txt |
|
||||
| /remote.php//dav/spaces/%spaceid%/PARENT/parent.txt |
|
||||
@@ -163,7 +163,7 @@ Feature: make webdav request with special urls
|
||||
|
||||
|
||||
Scenario: send PROPPATCH requests to webDav endpoints with 2 slashes
|
||||
When the user "Alice" requests these endpoints with "PROPPATCH" to set property "d:getlastmodified" with password "%regular%" about user "Alice"
|
||||
When user "Alice" requests these endpoints with "PROPPATCH" to set property "d:getlastmodified" about user "Alice"
|
||||
| endpoint |
|
||||
| //remote.php/webdav/textfile0.txt |
|
||||
| //remote.php//dav/files/%username%/textfile1.txt |
|
||||
@@ -174,7 +174,7 @@ Feature: make webdav request with special urls
|
||||
|
||||
@skipOnRevaMaster
|
||||
Scenario: send PROPPATCH requests to webDav endpoints with 2 slashes using the spaces WebDAV API
|
||||
When the user "Alice" requests these endpoints with "PROPPATCH" to set property "d:getlastmodified" with password "%regular%" about user "Alice"
|
||||
When user "Alice" requests these endpoints with "PROPPATCH" to set property "d:getlastmodified" about user "Alice"
|
||||
| endpoint |
|
||||
| //remote.php//dav/spaces/%spaceid%/textfile1.txt |
|
||||
| /remote.php//dav/spaces/%spaceid%/PARENT/parent.txt |
|
||||
|
||||
Reference in New Issue
Block a user