mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 11:19:39 -06:00
add Tests and Test Steps
This commit is contained in:
@@ -79,3 +79,35 @@ Feature: List and create spaces
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
|
||||
Scenario: A user can list his personal space via multiple endpoints
|
||||
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'personal'"
|
||||
Then the json responded should contain a space "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| name | Alice Hansen |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
When user "Alice" looks up the single space "Alice Hansen" via the GraphApi by using its id
|
||||
Then the json responded should contain a space "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| name | Alice Hansen |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
|
||||
Scenario: A user can list his created spaces via multiple endpoints
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the GraphApi
|
||||
Then the HTTP status code should be "201"
|
||||
And the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
When user "Alice" looks up the single space "Project Venus" via the GraphApi by using its id
|
||||
Then the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
|
||||
@@ -232,7 +232,7 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Graph List Spaces Request
|
||||
* Send Graph List My Spaces Request
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
@@ -245,7 +245,7 @@ class SpacesContext implements Context {
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function listSpacesRequest(
|
||||
public function listMySpacesRequest(
|
||||
string $user,
|
||||
string $password,
|
||||
string $urlArguments = '',
|
||||
@@ -258,6 +258,34 @@ class SpacesContext implements Context {
|
||||
return HttpRequestHelper::get($fullUrl, $xRequestId, $user, $password, $headers, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Graph List Single Space Request
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $urlArguments
|
||||
* @param string $xRequestId
|
||||
* @param array $body
|
||||
* @param array $headers
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function listSingleSpaceRequest(
|
||||
string $user,
|
||||
string $password,
|
||||
string $spaceId,
|
||||
string $urlArguments = '',
|
||||
string $xRequestId = '',
|
||||
array $body = [],
|
||||
array $headers = []
|
||||
): ResponseInterface {
|
||||
$fullUrl = $this->baseUrl . "/graph/v1.0/drives/" . $spaceId . "/" . $urlArguments;
|
||||
|
||||
return HttpRequestHelper::get($fullUrl, $xRequestId, $user, $password, $headers, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Graph Create Space Request
|
||||
*
|
||||
@@ -342,7 +370,7 @@ class SpacesContext implements Context {
|
||||
*/
|
||||
public function theUserListsAllHisAvailableSpacesUsingTheGraphApi(string $user): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->listSpacesRequest(
|
||||
$this->listMySpacesRequest(
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user)
|
||||
)
|
||||
@@ -362,7 +390,7 @@ class SpacesContext implements Context {
|
||||
*/
|
||||
public function theUserListsAllHisAvailableSpacesUsingTheGraphApiWithFilter(string $user, string $query): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->listSpacesRequest(
|
||||
$this->listMySpacesRequest(
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
"?". $query
|
||||
@@ -370,6 +398,30 @@ class SpacesContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" looks up the single space "([^"]*)" via the GraphApi by using its id$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $query
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function theUserLooksUpTheSingleSpaceUsingTheGraphApiByUsingItsId(string $user, string $spaceName): void {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
Assert::assertIsArray($space);
|
||||
Assert::assertNotEmpty($spaceId = $space["id"]);
|
||||
Assert::assertNotEmpty($spaceWebDavUrl = $space["root"]["webDavUrl"]);
|
||||
$this->featureContext->setResponse(
|
||||
$this->listSingleSpaceRequest(
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$spaceId
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with the default quota using the GraphApi$/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user