From de403f2f3da09015a07400d90703642a5eabcc65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 29 Jun 2018 13:35:17 +0200 Subject: [PATCH] Add integration test for creating room shares when Talk is not enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test just ensures that the controller will gracefully reject the creation instead of failing miserably; the integration tests when Talk is enabled are in the Talk repository. Signed-off-by: Daniel Calviño Sánchez --- .../features/bootstrap/Provisioning.php | 24 +++++++++++++++++++ build/integration/features/sharing-v1.feature | 12 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 1a2c32ed8c..c320be2be6 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -679,6 +679,30 @@ trait Provisioning { Assert::assertEquals(200, $this->response->getStatusCode()); } + /** + * @Given /^app "([^"]*)" is not enabled$/ + * + * Checks that the app is disabled or not installed. + * + * @param string $app + */ + public function appIsNotEnabled($app) { + $fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=enabled"; + $client = new Client(); + $options = []; + if ($this->currentUser === 'admin') { + $options['auth'] = $this->adminUser; + } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; + + $this->response = $client->get($fullUrl, $options); + $respondedArray = $this->getArrayOfAppsResponded($this->response); + Assert::assertNotContains($app, $respondedArray); + Assert::assertEquals(200, $this->response->getStatusCode()); + } + /** * @Then /^user "([^"]*)" is disabled$/ * @param string $user diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature index 5708b7115e..dd5cc9fff4 100644 --- a/build/integration/features/sharing-v1.feature +++ b/build/integration/features/sharing-v1.feature @@ -43,6 +43,18 @@ Feature: sharing Then the OCS status code should be "100" And the HTTP status code should be "200" + Scenario: Creating a new room share when Talk is not enabled + Given As an "admin" + And app "spreed" is not enabled + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareWith | a-room-token | + | shareType | 10 | + Then the OCS status code should be "403" + And the HTTP status code should be "401" + Scenario: Creating a new public share Given user "user0" exists And As an "user0"