Skip to content

Commit a15c473

Browse files
committed
feat(tests): Test application enabling/disabling and routes
Signed-off-by: Côme Chilliet <[email protected]>
1 parent f25d660 commit a15c473

File tree

4 files changed

+82
-1
lines changed

4 files changed

+82
-1
lines changed

.github/workflows/integration-sqlite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
- 'openldap_numerical_features'
6767
- 'ldap_features'
6868
- 'remoteapi_features'
69+
- 'routing_features'
6970
- 'setup_features'
7071
- 'sharees_features'
7172
- 'sharing_features'

build/integration/config/behat.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,14 @@ default:
253253
admin:
254254
- admin
255255
- admin
256-
regular_user_password: 123456
256+
regular_user_password: 123456
257+
routing:
258+
paths:
259+
- "%paths.base%/../routing_features"
260+
contexts:
261+
- RoutingContext:
262+
baseUrl: http://localhost:8080
263+
admin:
264+
- admin
265+
- admin
266+
regular_user_password: 123456
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
4+
* SPDX-License-Identifier: AGPL-3.0-or-later
5+
*/
6+
use Behat\Behat\Context\Context;
7+
use Behat\Behat\Context\SnippetAcceptingContext;
8+
9+
require __DIR__ . '/../../vendor/autoload.php';
10+
11+
class RoutingContext implements Context, SnippetAcceptingContext {
12+
use Provisioning;
13+
use AppConfiguration;
14+
use CommandLine;
15+
16+
protected function resetAppConfigs(): void {
17+
}
18+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
Feature: appmanagement
4+
Background:
5+
Given using api version "2"
6+
And user "user1" exists
7+
And user "user2" exists
8+
And group "group1" exists
9+
And user "user1" belongs to group "group1"
10+
11+
Scenario: Enable app and test route
12+
Given As an "admin"
13+
And sending "DELETE" to "/cloud/apps/weather_status"
14+
And app "weather_status" is disabled
15+
When sending "GET" to "/apps/weather_status/api/v1/location"
16+
Then the OCS status code should be "998"
17+
And the HTTP status code should be "404"
18+
When sending "POST" to "/cloud/apps/weather_status"
19+
Then the OCS status code should be "200"
20+
And the HTTP status code should be "200"
21+
And app "weather_status" is enabled
22+
When sending "GET" to "/apps/weather_status/api/v1/location"
23+
Then the OCS status code should be "200"
24+
And the HTTP status code should be "200"
25+
Given As an "user1"
26+
When sending "GET" to "/apps/weather_status/api/v1/location"
27+
Then the OCS status code should be "200"
28+
And the HTTP status code should be "200"
29+
Given As an "user2"
30+
When sending "GET" to "/apps/weather_status/api/v1/location"
31+
Then the OCS status code should be "200"
32+
And the HTTP status code should be "200"
33+
34+
Scenario: Enable app only for some groups
35+
Given As an "admin"
36+
And sending "DELETE" to "/cloud/apps/weather_status"
37+
And app "weather_status" is disabled
38+
When sending "GET" to "/apps/weather_status/api/v1/location"
39+
Then the OCS status code should be "998"
40+
And the HTTP status code should be "404"
41+
Given invoking occ with "app:enable weather_status --groups group1"
42+
Then the command was successful
43+
Given As an "user2"
44+
When sending "GET" to "/apps/weather_status/api/v1/location"
45+
Then the HTTP status code should be "412"
46+
Given As an "user1"
47+
When sending "GET" to "/apps/weather_status/api/v1/location"
48+
Then the OCS status code should be "200"
49+
And the HTTP status code should be "200"
50+
Given As an "admin"
51+
And sending "DELETE" to "/cloud/apps/weather_status"
52+
And app "weather_status" is disabled

0 commit comments

Comments
 (0)