Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] add tests to check settings api response #10827

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ config = {
"apiDepthInfinity",
"apiLocks",
"apiActivities",
"apiSettings",
],
"skip": False,
},
Expand Down
60 changes: 58 additions & 2 deletions tests/acceptance/bootstrap/SettingsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getRoles(string $user): ResponseInterface {
}

/**
* @When /^user "([^"]*)" tries to get all existing roles$/
* @When /^user "([^"]*)" tries to get all existing roles using the settings API$/
*
* @param string $user
*
Expand Down Expand Up @@ -139,6 +139,30 @@ public function theAdministratorHasGivenUserTheRole(string $user, string $role):
);
}

/**
* @When user :assigner assigns the role :role to user :assignee using the settings API
*
* @param string $assigner
* @param string $role
* @param string $assignee
*
* @return void
*
* @throws Exception
*/
public function userAssignsTheRoleToUserUsingTheSettingsApi(
string $assigner,
string $role,
string $assignee
): void {
$response = $this->assignRoleToUser(
$assigner,
$this->featureContext->getAttributeOfCreatedUser($assignee, 'id'),
$this->getRoleIdByRoleName($assigner, $role)
);
$this->featureContext->setResponse($response);
}

/**
* @param string $user
* @param string $role
Expand Down Expand Up @@ -232,7 +256,7 @@ public function userChangeRoleAnotherUser(string $user, string $role, string $as
}

/**
* @When /^user "([^"]*)" tries to get list of assignment$/
* @When /^user "([^"]*)" tries to get list of assignment using the settings API$/
*
* @param string $user
*
Expand Down Expand Up @@ -444,6 +468,22 @@ public function theUserHasSwitchedSystemLanguage(string $user, string $language)
);
}

/**
* @When user :user switches the system language to :language using the settings API
*
* @param string $user
* @param string $language
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userSwitchesTheSystemLanguageUsingTheSettingsApi(string $user, string $language): void {
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
$this->featureContext->setResponse($response);
}

/**
* @param string $user
*
Expand Down Expand Up @@ -497,4 +537,20 @@ public function theUserHasDisabledAutoAccepting(string $user): void {
);
$this->featureContext->rememberUserAutoSyncSetting($user, false);
}

/**
* @When user :user disables the auto-sync share using the settings API
*
* @param string $user
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userDisablesAutoAcceptingUsingSettingsApi(string $user): void {
$response = $this->sendRequestToDisableAutoAccepting($user);
$this->featureContext->setResponse($response);
prashant-gurung899 marked this conversation as resolved.
Show resolved Hide resolved
$this->featureContext->rememberUserAutoSyncSetting($user, false);
}
}
9 changes: 9 additions & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ default:
- OcisConfigContext:
- SettingsContext:

apiSettings:
paths:
- "%paths.base%/../features/apiSettings"
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
- GraphContext:
- SettingsContext:

apiSharingNgShareInvitation:
paths:
- "%paths.base%/../features/apiSharingNgShareInvitation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: assign role
Scenario Outline: only admin user can see all existing roles
Given user "Alice" has been created with default attributes
And the administrator has given "Alice" the role "<user-role>" using the settings api
When user "Alice" tries to get all existing roles
When user "Alice" tries to get all existing roles using the settings API
Then the HTTP status code should be "<http-status-code>"
Examples:
| user-role | http-status-code |
Expand All @@ -19,7 +19,7 @@ Feature: assign role
Scenario Outline: only admin user can see assignments list
Given user "Alice" has been created with default attributes
And the administrator has given "Alice" the role "<user-role>" using the settings api
When user "Alice" tries to get list of assignment
When user "Alice" tries to get list of assignment using the settings API
Then the HTTP status code should be "<http-status-code>"
Examples:
| user-role | http-status-code |
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiGraph/getAssignedRole.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: assign role
@issue-5032
Scenario Outline: get assigned role of a user via setting api
Given the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
When user "Alice" tries to get list of assignment
When user "Alice" tries to get list of assignment using the settings API
Then the HTTP status code should be "<http-status-code>"
And the setting API response should have the role "<user-role>"
prashant-gurung899 marked this conversation as resolved.
Show resolved Hide resolved
Examples:
Expand Down
Loading