mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-05 19:59:37 -06:00
test: check application/octet-stream MIME Type absence on /app/list endpoint
This commit is contained in:
@@ -24,6 +24,7 @@ use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\CollaborationHelper;
|
||||
@@ -324,4 +325,34 @@ class CollaborationContext implements Context {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response (should|should not) contain the following MIME types:$/
|
||||
*
|
||||
* @param string $shouldOrNot
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table):void {
|
||||
$rows = $table->getRows();
|
||||
$responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['mime-types'];
|
||||
$mimeTypes = \array_column($responseArray, 'mime_type');
|
||||
foreach ($rows as $row) {
|
||||
if ($shouldOrNot === "should not") {
|
||||
Assert::assertFalse(
|
||||
\in_array($row[0], $mimeTypes),
|
||||
"the response should not contain the mimetype $row[0].\nMime Types found in response:\n"
|
||||
. print_r($mimeTypes, true)
|
||||
);
|
||||
} else {
|
||||
Assert::assertTrue(
|
||||
\in_array($row[0], $mimeTypes),
|
||||
"the response does not contain the mimetype $row[0].\nMime Types found in response:\n"
|
||||
. print_r($mimeTypes, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1855,3 +1855,10 @@ Feature: check file info with different wopi apps
|
||||
| Collabora |
|
||||
| FakeOffice |
|
||||
| OnlyOffice |
|
||||
|
||||
@issue-10086
|
||||
Scenario: check that '/app/list' doesn't contain 'application/octet-stream' MIME type
|
||||
When user "Alice" sends HTTP method "GET" to URL "/app/list"
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should not contain the following MIME types:
|
||||
| application/octet-stream |
|
||||
|
||||
Reference in New Issue
Block a user