Skip to content

Commit cccd0e9

Browse files
authored
Merge pull request #10827 from owncloud/tests-setting-api
[tests-only][full-ci] add tests to check settings api response
2 parents cd98194 + 11b5e8c commit cccd0e9

File tree

6 files changed

+348
-5
lines changed

6 files changed

+348
-5
lines changed

.drone.star

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ config = {
8888
"apiDepthInfinity",
8989
"apiLocks",
9090
"apiActivities",
91+
"apiSettings",
9192
],
9293
"skip": False,
9394
},

tests/acceptance/bootstrap/SettingsContext.php

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getRoles(string $user): ResponseInterface {
6363
}
6464

6565
/**
66-
* @When /^user "([^"]*)" tries to get all existing roles$/
66+
* @When /^user "([^"]*)" tries to get all existing roles using the settings API$/
6767
*
6868
* @param string $user
6969
*
@@ -139,6 +139,30 @@ public function theAdministratorHasGivenUserTheRole(string $user, string $role):
139139
);
140140
}
141141

142+
/**
143+
* @When user :assigner assigns the role :role to user :assignee using the settings API
144+
*
145+
* @param string $assigner
146+
* @param string $role
147+
* @param string $assignee
148+
*
149+
* @return void
150+
*
151+
* @throws Exception
152+
*/
153+
public function userAssignsTheRoleToUserUsingTheSettingsApi(
154+
string $assigner,
155+
string $role,
156+
string $assignee
157+
): void {
158+
$response = $this->assignRoleToUser(
159+
$assigner,
160+
$this->featureContext->getAttributeOfCreatedUser($assignee, 'id'),
161+
$this->getRoleIdByRoleName($assigner, $role)
162+
);
163+
$this->featureContext->setResponse($response);
164+
}
165+
142166
/**
143167
* @param string $user
144168
* @param string $role
@@ -232,7 +256,7 @@ public function userChangeRoleAnotherUser(string $user, string $role, string $as
232256
}
233257

234258
/**
235-
* @When /^user "([^"]*)" tries to get list of assignment$/
259+
* @When /^user "([^"]*)" tries to get list of assignment using the settings API$/
236260
*
237261
* @param string $user
238262
*
@@ -444,6 +468,22 @@ public function theUserHasSwitchedSystemLanguage(string $user, string $language)
444468
);
445469
}
446470

471+
/**
472+
* @When user :user switches the system language to :language using the settings API
473+
*
474+
* @param string $user
475+
* @param string $language
476+
*
477+
* @return void
478+
*
479+
* @throws Exception
480+
* @throws GuzzleException
481+
*/
482+
public function userSwitchesTheSystemLanguageUsingTheSettingsApi(string $user, string $language): void {
483+
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
484+
$this->featureContext->setResponse($response);
485+
}
486+
447487
/**
448488
* @param string $user
449489
*
@@ -497,4 +537,20 @@ public function theUserHasDisabledAutoAccepting(string $user): void {
497537
);
498538
$this->featureContext->rememberUserAutoSyncSetting($user, false);
499539
}
540+
541+
/**
542+
* @When user :user disables the auto-sync share using the settings API
543+
*
544+
* @param string $user
545+
*
546+
* @return void
547+
*
548+
* @throws Exception
549+
* @throws GuzzleException
550+
*/
551+
public function userDisablesAutoAcceptingUsingSettingsApi(string $user): void {
552+
$response = $this->sendRequestToDisableAutoAccepting($user);
553+
$this->featureContext->setResponse($response);
554+
$this->featureContext->rememberUserAutoSyncSetting($user, false);
555+
}
500556
}

tests/acceptance/config/behat.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,15 @@ default:
351351
- OcisConfigContext:
352352
- SettingsContext:
353353

354+
apiSettings:
355+
paths:
356+
- "%paths.base%/../features/apiSettings"
357+
context: *common_ldap_suite_context
358+
contexts:
359+
- FeatureContext: *common_feature_context_params
360+
- GraphContext:
361+
- SettingsContext:
362+
354363
apiSharingNgShareInvitation:
355364
paths:
356365
- "%paths.base%/../features/apiSharingNgShareInvitation"

tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: assign role
77
Scenario Outline: only admin user can see all existing roles
88
Given user "Alice" has been created with default attributes
99
And the administrator has given "Alice" the role "<user-role>" using the settings api
10-
When user "Alice" tries to get all existing roles
10+
When user "Alice" tries to get all existing roles using the settings API
1111
Then the HTTP status code should be "<http-status-code>"
1212
Examples:
1313
| user-role | http-status-code |
@@ -19,7 +19,7 @@ Feature: assign role
1919
Scenario Outline: only admin user can see assignments list
2020
Given user "Alice" has been created with default attributes
2121
And the administrator has given "Alice" the role "<user-role>" using the settings api
22-
When user "Alice" tries to get list of assignment
22+
When user "Alice" tries to get list of assignment using the settings API
2323
Then the HTTP status code should be "<http-status-code>"
2424
Examples:
2525
| user-role | http-status-code |

tests/acceptance/features/apiGraph/getAssignedRole.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Feature: assign role
2222
@issue-5032
2323
Scenario Outline: get assigned role of a user via setting api
2424
Given the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
25-
When user "Alice" tries to get list of assignment
25+
When user "Alice" tries to get list of assignment using the settings API
2626
Then the HTTP status code should be "<http-status-code>"
2727
And the setting API response should have the role "<user-role>"
2828
Examples:

0 commit comments

Comments
 (0)