Merge pull request #5275 from owncloud/sendInvalidUuid
[test-only] ApiTest. sending invalid data to graph API
This commit is contained in:
2 files changed
+33
-9
No files matched your search
@@ -223,3 +223,12 @@ Feature: Change data of space
|
||||
| 10000 | between "201" and "204" |
|
||||
| 0 | between "201" and "204" |
|
||||
| -1 | between "201" and "204" |
|
||||
|
||||
|
||||
Scenario: user sends invalid space uuid via the Graph API
|
||||
When user "Admin" tries to change the name of the "non-existing" space to "new name"
|
||||
Then the HTTP status code should be "404"
|
||||
When user "Admin" tries to change the quota of the "non-existing" space to "10"
|
||||
Then the HTTP status code should be "404"
|
||||
When user "Alice" tries to change the description of the "non-existing" space to "new description"
|
||||
Then the HTTP status code should be "404"
|
||||
@@ -1271,7 +1271,7 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" changes the name of the "([^"]*)" space to "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" (?:changes|tries to change) the name of the "([^"]*)" space to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
@@ -1286,8 +1286,13 @@ class SpacesContext implements Context {
|
||||
string $spaceName,
|
||||
string $newName
|
||||
): void {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$spaceId = $space["id"];
|
||||
if ($spaceName === "non-existing") {
|
||||
// check sending invalid data
|
||||
$spaceId = "39c49dd3-1f24-4687-97d1-42df43f71713";
|
||||
} else {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$spaceId = $space["id"];
|
||||
}
|
||||
|
||||
$bodyData = ["Name" => $newName];
|
||||
$body = json_encode($bodyData, JSON_THROW_ON_ERROR);
|
||||
@@ -1304,7 +1309,7 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" changes the description of the "([^"]*)" space to "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" (?:changes|tries to change) the description of the "([^"]*)" space to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
@@ -1319,8 +1324,13 @@ class SpacesContext implements Context {
|
||||
string $spaceName,
|
||||
string $newDescription
|
||||
): void {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$spaceId = $space["id"];
|
||||
if ($spaceName === "non-existing") {
|
||||
// check sending invalid data
|
||||
$spaceId = "39c49dd3-1f24-4687-97d1-42df43f71713";
|
||||
} else {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$spaceId = $space["id"];
|
||||
}
|
||||
|
||||
$bodyData = ["description" => $newDescription];
|
||||
$body = json_encode($bodyData, JSON_THROW_ON_ERROR);
|
||||
@@ -1337,7 +1347,7 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" changes the quota of the "([^"]*)" space to "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" (?:changes|tries to change) the quota of the "([^"]*)" space to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
@@ -1352,8 +1362,13 @@ class SpacesContext implements Context {
|
||||
string $spaceName,
|
||||
int $newQuota
|
||||
): void {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$spaceId = $space["id"];
|
||||
if ($spaceName === "non-existing") {
|
||||
// check sending invalid data
|
||||
$spaceId = "39c49dd3-1f24-4687-97d1-42df43f71713";
|
||||
} else {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$spaceId = $space["id"];
|
||||
}
|
||||
|
||||
$bodyData = ["quota" => ["total" => $newQuota]];
|
||||
$body = json_encode($bodyData, JSON_THROW_ON_ERROR);
|
||||
|
||||
Reference in new issue
Block a user