diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-06-03 14:04:34 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-06-05 15:12:28 +0200 |
commit | a15c473ae269005938a20f2567c33e7e3554a3b6 (patch) | |
tree | ea36c050a72d2c7ab675b47b10730a37cf8a44c2 | |
parent | f25d66008b7af7291b78521708f76bc9da6f2365 (diff) | |
download | nextcloud-server-feat/test-app-routes.tar.gz nextcloud-server-feat/test-app-routes.zip |
feat(tests): Test application enabling/disabling and routesfeat/test-app-routes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | .github/workflows/integration-sqlite.yml | 1 | ||||
-rw-r--r-- | build/integration/config/behat.yml | 12 | ||||
-rw-r--r-- | build/integration/features/bootstrap/RoutingContext.php | 18 | ||||
-rw-r--r-- | build/integration/routing_features/apps-and-routes.feature | 52 |
4 files changed, 82 insertions, 1 deletions
diff --git a/.github/workflows/integration-sqlite.yml b/.github/workflows/integration-sqlite.yml index b067ff75674..32d49c06c11 100644 --- a/.github/workflows/integration-sqlite.yml +++ b/.github/workflows/integration-sqlite.yml @@ -66,6 +66,7 @@ jobs: - 'openldap_numerical_features' - 'ldap_features' - 'remoteapi_features' + - 'routing_features' - 'setup_features' - 'sharees_features' - 'sharing_features' diff --git a/build/integration/config/behat.yml b/build/integration/config/behat.yml index 45db5105838..f619216e6f8 100644 --- a/build/integration/config/behat.yml +++ b/build/integration/config/behat.yml @@ -253,4 +253,14 @@ default: admin: - admin - admin - regular_user_password: 123456
\ No newline at end of file + regular_user_password: 123456 + routing: + paths: + - "%paths.base%/../routing_features" + contexts: + - RoutingContext: + baseUrl: http://localhost:8080 + admin: + - admin + - admin + regular_user_password: 123456 diff --git a/build/integration/features/bootstrap/RoutingContext.php b/build/integration/features/bootstrap/RoutingContext.php new file mode 100644 index 00000000000..37cbbb0cdee --- /dev/null +++ b/build/integration/features/bootstrap/RoutingContext.php @@ -0,0 +1,18 @@ +<?php +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +use Behat\Behat\Context\Context; +use Behat\Behat\Context\SnippetAcceptingContext; + +require __DIR__ . '/../../vendor/autoload.php'; + +class RoutingContext implements Context, SnippetAcceptingContext { + use Provisioning; + use AppConfiguration; + use CommandLine; + + protected function resetAppConfigs(): void { + } +} diff --git a/build/integration/routing_features/apps-and-routes.feature b/build/integration/routing_features/apps-and-routes.feature new file mode 100644 index 00000000000..954ea73bfac --- /dev/null +++ b/build/integration/routing_features/apps-and-routes.feature @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +Feature: appmanagement + Background: + Given using api version "2" + And user "user1" exists + And user "user2" exists + And group "group1" exists + And user "user1" belongs to group "group1" + + Scenario: Enable app and test route + Given As an "admin" + And sending "DELETE" to "/cloud/apps/weather_status" + And app "weather_status" is disabled + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the OCS status code should be "998" + And the HTTP status code should be "404" + When sending "POST" to "/cloud/apps/weather_status" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + And app "weather_status" is enabled + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + Given As an "user1" + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + Given As an "user2" + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + + Scenario: Enable app only for some groups + Given As an "admin" + And sending "DELETE" to "/cloud/apps/weather_status" + And app "weather_status" is disabled + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the OCS status code should be "998" + And the HTTP status code should be "404" + Given invoking occ with "app:enable weather_status --groups group1" + Then the command was successful + Given As an "user2" + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the HTTP status code should be "412" + Given As an "user1" + When sending "GET" to "/apps/weather_status/api/v1/location" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + Given As an "admin" + And sending "DELETE" to "/cloud/apps/weather_status" + And app "weather_status" is disabled |