ocis icon indicating copy to clipboard operation
ocis copied to clipboard

Test coverage for setting api

Open amrita-shrestha opened this issue 10 months ago • 2 comments

Describe

OCIS has provided documentation for grpc-setting. However, there's an issue tagged as #1349 regarding the documentation of an API endpoint, yet no corresponding pull request has been linked to it. Notably, there isn't specific test coverage dedicated to the setting API. However, the setting API has been employed to meet prerequisites and verify outcomes for features related to notifications and roles.

Overview of used setting API on OCIS API tests

https://github.com/owncloud/ocis/blob/c179485db65d92fa2bb96e48cb01fa92e125d497/tests/acceptance/features/bootstrap/SettingsContext.php contain all code related to setting API settings endpoint = /api/v0/settings/

endpoint functions steps
/api/v0/settings/roles-list 1.getAllExistingRoles->getRoles
2.getRoleIdByRoleName->getRoles
1.@When /^user "([^"])" tries to get all existing roles$/
2.@Given /^the administrator has given "([^"]
)" the role "([^"]*)" using the settings api$/
/api/v0/settings/assignments-add 1.theAdministratorHasGivenUserTheRole->assignRoleToUser
2.userChangeOwnRole->assignRoleToUser
3. userChangeRoleAnotherUser->assignRoleToUser
1. @Given /^the administrator has given "([^"])" the role "([^"])" using the settings api$/
2. @When /^user "([^"])" changes his own role to "([^"])"$/
3. @When /^user "([^"])" changes the role "([^"])" for user "([^"]*)"$/
/api/v0/settings/assignments-list 1. userGetAssignmentsList->getAssignmentsList
2. userShouldHaveRole->getAssignmentsList
1. @When /^user "([^"])" tries to get list of assignment$/
2. @Then /^user "([^"]
)" should have the role "([^"]*)"$/
/api/v0/settings/bundles-list 1. sendRequestToSwitchSystemLanguage->getBundlesList->sendRequestGetBundlesList 1.@Given /^user "([^"])" has switched the system language to "([^"])" using the settings API$/
/api/v0/settings/values-list 1. theUserListsAllValuesListWithHeadersUsingSettingsApi->sendRequestGetSettingsValuesList
2. listAllNotifications->getSettingLanguageValue->sendRequestGetSettingsValuesList
1. @When /^user "([^"]*)" lists values-list with headers using the Settings API$/
/api/v0/settings/values-save 1. sendRequestToSwitchSystemLanguage 1. @Given /^user "([^"])" has switched the system language to "([^"])" using the settings API$/
/api/v0/settings/values-save 1. theUserHasDisabledAutoAccepting->sendRequestToDisableAutoAccepting 1.@Given user :user has disabled the auto-sync share

Point to discuss

  • are we going to write dedicated test coverage for setting API

amrita-shrestha avatar Apr 08 '24 11:04 amrita-shrestha

We have this api but we have replaced many of the settings api endpoinds with a graph example: https://github.com/owncloud/ocis/pull/6538

I wouldn't put any more effort into it than that. I would just created setting feature and check that it works without edge cases.

ScharfViktor avatar Apr 10 '24 08:04 ScharfViktor

What about the security of the endpoint?

individual-it avatar Apr 24 '24 08:04 individual-it