mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-07 12:01:27 -05:00
[tests-only][full-ci] forward port user and group search tests (#8240)
* fixing json assertion for addUserToGroup.feature * adding tests for searching groups as a normal user * adding tests for searching user as a normal user * fixing json assertion for removeUserFromGroup.feature * fixing json assertion for listPermissions.feature
This commit is contained in:
@@ -259,6 +259,32 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $adminUser
|
||||
* @param string $adminPassword
|
||||
* @param string $searchTerm
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function searchUser(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
string $searchTerm
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, "users?\$search=$searchTerm");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
@@ -554,6 +580,32 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $searchTerm
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function searchGroup(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $searchTerm
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, "groups?\$search=$searchTerm");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
|
||||
@@ -59,8 +59,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
|
||||
#### [A User can get information of another user with Graph API](https://github.com/owncloud/ocis/issues/5125)
|
||||
|
||||
- [apiGraph/getUser.feature:87](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L87)
|
||||
- [apiGraph/getUser.feature:88](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L88)
|
||||
- [apiGraph/getUser.feature:89](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L89)
|
||||
- [apiGraph/getUser.feature:90](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L90)
|
||||
- [apiGraph/getUser.feature:91](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L91)
|
||||
@@ -71,37 +69,39 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiGraph/getUser.feature:96](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L96)
|
||||
- [apiGraph/getUser.feature:97](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L97)
|
||||
- [apiGraph/getUser.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L98)
|
||||
- [apiGraph/getUser.feature:642](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L642)
|
||||
- [apiGraph/getUser.feature:643](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L643)
|
||||
- [apiGraph/getUser.feature:644](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L644)
|
||||
- [apiGraph/getUser.feature:645](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L645)
|
||||
- [apiGraph/getUser.feature:646](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L646)
|
||||
- [apiGraph/getUser.feature:647](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L647)
|
||||
- [apiGraph/getUser.feature:648](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L648)
|
||||
- [apiGraph/getUser.feature:649](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L649)
|
||||
- [apiGraph/getUser.feature:99](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L99)
|
||||
- [apiGraph/getUser.feature:100](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L100)
|
||||
- [apiGraph/getUser.feature:650](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L650)
|
||||
- [apiGraph/getUser.feature:651](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L651)
|
||||
- [apiGraph/getUser.feature:652](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L652)
|
||||
- [apiGraph/getUser.feature:653](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L653)
|
||||
- [apiGraph/getUser.feature:654](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L654)
|
||||
- [apiGraph/getUser.feature:655](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L655)
|
||||
- [apiGraph/getUser.feature:656](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L656)
|
||||
- [apiGraph/getUser.feature:657](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L657)
|
||||
- [apiGraph/getUser.feature:658](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L658)
|
||||
- [apiGraph/getUser.feature:659](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L659)
|
||||
- [apiGraph/getUser.feature:660](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L660)
|
||||
- [apiGraph/getUser.feature:661](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L661)
|
||||
|
||||
#### [Normal user can get expanded members information of a group](https://github.com/owncloud/ocis/issues/5604)
|
||||
|
||||
- [apiGraph/getGroup.feature:381](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L381)
|
||||
- [apiGraph/getGroup.feature:382](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L382)
|
||||
- [apiGraph/getGroup.feature:383](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L383)
|
||||
- [apiGraph/getGroup.feature:389](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L389)
|
||||
- [apiGraph/getGroup.feature:390](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L390)
|
||||
- [apiGraph/getGroup.feature:391](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L391)
|
||||
|
||||
#### [Same users can be added in a group multiple time](https://github.com/owncloud/ocis/issues/5702)
|
||||
|
||||
- [apiGraph/addUserToGroup.feature:285](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L285)
|
||||
- [apiGraph/addUserToGroup.feature:289](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L289)
|
||||
|
||||
#### [API requests from an unauthorized user should return 403](https://github.com/owncloud/ocis/issues/5938)
|
||||
|
||||
- [apiGraph/addUserToGroup.feature:150](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L150)
|
||||
- [apiGraph/addUserToGroup.feature:151](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L151)
|
||||
- [apiGraph/addUserToGroup.feature:152](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L152)
|
||||
- [apiGraph/addUserToGroup.feature:184](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L184)
|
||||
- [apiGraph/addUserToGroup.feature:185](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L185)
|
||||
- [apiGraph/addUserToGroup.feature:186](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L186)
|
||||
- [apiGraph/addUserToGroup.feature:153](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L153)
|
||||
- [apiGraph/addUserToGroup.feature:154](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L154)
|
||||
- [apiGraph/addUserToGroup.feature:188](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L188)
|
||||
- [apiGraph/addUserToGroup.feature:189](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L189)
|
||||
- [apiGraph/addUserToGroup.feature:190](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L190)
|
||||
- [apiGraph/createGroup.feature:42](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroup.feature#L42)
|
||||
- [apiGraph/createGroup.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroup.feature#L43)
|
||||
- [apiGraph/createGroup.feature:44](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroup.feature#L44)
|
||||
@@ -111,27 +111,27 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiGraph/editGroup.feature:35](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L35)
|
||||
- [apiGraph/editGroup.feature:34](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L34)
|
||||
- [apiGraph/editGroup.feature:36](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L36)
|
||||
- [apiGraph/getGroup.feature:103](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L103)
|
||||
- [apiGraph/getGroup.feature:104](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L104)
|
||||
- [apiGraph/getGroup.feature:105](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L105)
|
||||
- [apiGraph/removeUserFromGroup.feature:191](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/removeUserFromGroup.feature#L191)
|
||||
- [apiGraph/removeUserFromGroup.feature:192](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/removeUserFromGroup.feature#L192)
|
||||
- [apiGraph/getGroup.feature:107](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L107)
|
||||
- [apiGraph/getGroup.feature:108](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L108)
|
||||
- [apiGraph/getGroup.feature:109](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L109)
|
||||
- [apiGraph/removeUserFromGroup.feature:193](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/removeUserFromGroup.feature#L193)
|
||||
- [apiGraph/removeUserFromGroup.feature:194](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/removeUserFromGroup.feature#L194)
|
||||
- [apiGraph/removeUserFromGroup.feature:195](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/removeUserFromGroup.feature#L195)
|
||||
|
||||
#### [API requests for a non-existent resources should return 404](https://github.com/owncloud/ocis/issues/5939)
|
||||
|
||||
- [apiGraph/addUserToGroup.feature:201](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L201)
|
||||
- [apiGraph/addUserToGroup.feature:202](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L202)
|
||||
- [apiGraph/addUserToGroup.feature:203](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L203)
|
||||
- [apiGraph/addUserToGroup.feature:205](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L205)
|
||||
- [apiGraph/addUserToGroup.feature:206](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L206)
|
||||
- [apiGraph/addUserToGroup.feature:207](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L207)
|
||||
|
||||
### [Users are added in a group with wrong host in host-part of user](https://github.com/owncloud/ocis/issues/5871)
|
||||
|
||||
- [apiGraph/addUserToGroup.feature:369](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L369)
|
||||
- [apiGraph/addUserToGroup.feature:383](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L383)
|
||||
- [apiGraph/addUserToGroup.feature:373](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L373)
|
||||
- [apiGraph/addUserToGroup.feature:387](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L387)
|
||||
|
||||
### [Adding the same user as multiple members in a single request results in listing the same user twice in the group](https://github.com/owncloud/ocis/issues/5855)
|
||||
|
||||
- [apiGraph/addUserToGroup.feature:420](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L420)
|
||||
- [apiGraph/addUserToGroup.feature:424](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L424)
|
||||
|
||||
### [Shared file locking is not possible using different path](https://github.com/owncloud/ocis/issues/7599)
|
||||
|
||||
|
||||
@@ -138,8 +138,10 @@ Feature: add users to group
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,8 +174,10 @@ Feature: add users to group
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message" : {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,10 @@ Feature: get groups and their members
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,8 +93,10 @@ Feature: get groups and their members
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,8 +259,10 @@ Feature: get groups and their members
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,8 +375,10 @@ Feature: get groups and their members
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -444,3 +452,117 @@ Feature: get groups and their members
|
||||
Scenario: admin user tries to get group information of non-existing group
|
||||
When user "Alice" gets details of the group "non-existing" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario Outline: non-admin user search for a group by group name
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And group "tea-lover" has been created
|
||||
When user "Brian" searches for group "<group>" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"value"
|
||||
],
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "array",
|
||||
"required": [
|
||||
"displayName",
|
||||
"id",
|
||||
"groupTypes"
|
||||
],
|
||||
"properties": {
|
||||
"displayName": {
|
||||
"type": "string",
|
||||
"enum": ["tea-lover"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "%group_id_pattern%"
|
||||
},
|
||||
"groupTypes": {
|
||||
"type": "array",
|
||||
"enum": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| group |
|
||||
| tea |
|
||||
| %22tea-%22 |
|
||||
|
||||
|
||||
Scenario: non-admin user tries to search for a group by group name with less than 3 characters
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And group "tea-lover" has been created
|
||||
When user "Brian" tries to search for group "te" using Graph API
|
||||
Then the HTTP status code should be "403"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"error"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"message":{
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@issue-7990
|
||||
Scenario Outline: non-admin user tries to search for a group by group name with invalid characters/token
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And group "<group>" has been created
|
||||
When user "Brian" tries to search for group "<group>" using Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"error"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Token '<token>' is invalid"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| group | token |
|
||||
| tea-lovers | -lovers |
|
||||
| tea@lovers | @lovers |
|
||||
@@ -75,8 +75,10 @@ Feature: get users
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message":{
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,8 +271,10 @@ Feature: get users
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,14 +363,16 @@ Feature: get users
|
||||
"user"
|
||||
],
|
||||
"properties": {
|
||||
"user": "string",
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%user_id_pattern%"]
|
||||
"user": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "%user_id_pattern%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -630,8 +636,10 @@ Feature: get users
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message: {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -905,8 +913,10 @@ Feature: get users
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1057,8 +1067,10 @@ Feature: get users
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1327,3 +1339,107 @@ Feature: get users
|
||||
| Space Admin |
|
||||
| User |
|
||||
| User Light |
|
||||
|
||||
|
||||
Scenario: non-admin user searches other users by display name
|
||||
When user "Brian" searches for user "ali" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"value"
|
||||
],
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "array",
|
||||
"required": [
|
||||
"displayName",
|
||||
"id",
|
||||
"mail",
|
||||
"userType"
|
||||
],
|
||||
"properties": {
|
||||
"displayName": {
|
||||
"type": "string",
|
||||
"enum": ["Alice Hansen"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%user_id_pattern%$"
|
||||
},
|
||||
"mail": {
|
||||
"type": "string",
|
||||
"enum": ["alice@example.org"]
|
||||
},
|
||||
"userType": {
|
||||
"type": "string",
|
||||
"enum": ["Member"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: non-admin user tries to search for a user by display name with less than 3 characters
|
||||
When user "Brian" tries to search for user "al" using Graph API
|
||||
Then the HTTP status code should be "403"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"error"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["search term too short"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@issue-7990
|
||||
Scenario Outline: non-admin user tries to search for a user by display name with invalid characters/token
|
||||
Given user "<user>" has been created with default attributes and without skeleton files
|
||||
When user "Brian" tries to search for user "<user>" using Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"error"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Token '<errorToken>' is invalid"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user | errorToken |
|
||||
| Alice-From-Wonderland | -From-Wonderland |
|
||||
| Alice@From@Wonderland | @From@Wonderland |
|
||||
|
||||
@@ -178,8 +178,10 @@ Feature: remove a user from a group
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Unauthorized"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,31 +22,28 @@ Feature: List a sharing permissions
|
||||
"properties": {
|
||||
"@libre.graph.permissions.actions.allowedValues": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "string",
|
||||
"required": [
|
||||
"libre.graph/driveItem/permissions/create",
|
||||
"libre.graph/driveItem/children/create",
|
||||
"libre.graph/driveItem/standard/delete",
|
||||
"libre.graph/driveItem/path/read",
|
||||
"libre.graph/driveItem/quota/read",
|
||||
"libre.graph/driveItem/content/read",
|
||||
"libre.graph/driveItem/upload/create",
|
||||
"libre.graph/driveItem/permissions/read",
|
||||
"libre.graph/driveItem/children/read",
|
||||
"libre.graph/driveItem/versions/read",
|
||||
"libre.graph/driveItem/deleted/read",
|
||||
"libre.graph/driveItem/path/update",
|
||||
"libre.graph/driveItem/permissions/delete",
|
||||
"libre.graph/driveItem/deleted/delete",
|
||||
"libre.graph/driveItem/versions/update",
|
||||
"libre.graph/driveItem/deleted/update",
|
||||
"libre.graph/driveItem/basic/read",
|
||||
"libre.graph/driveItem/permissions/update",
|
||||
"libre.graph/driveItem/permissions/deny"
|
||||
]
|
||||
}
|
||||
"enum": [
|
||||
[
|
||||
"libre.graph/driveItem/permissions/create",
|
||||
"libre.graph/driveItem/children/create",
|
||||
"libre.graph/driveItem/standard/delete",
|
||||
"libre.graph/driveItem/path/read",
|
||||
"libre.graph/driveItem/quota/read",
|
||||
"libre.graph/driveItem/content/read",
|
||||
"libre.graph/driveItem/upload/create",
|
||||
"libre.graph/driveItem/permissions/read",
|
||||
"libre.graph/driveItem/children/read",
|
||||
"libre.graph/driveItem/versions/read",
|
||||
"libre.graph/driveItem/deleted/read",
|
||||
"libre.graph/driveItem/path/update",
|
||||
"libre.graph/driveItem/permissions/delete",
|
||||
"libre.graph/driveItem/deleted/delete",
|
||||
"libre.graph/driveItem/versions/update",
|
||||
"libre.graph/driveItem/deleted/update",
|
||||
"libre.graph/driveItem/basic/read",
|
||||
"libre.graph/driveItem/permissions/update",
|
||||
"libre.graph/driveItem/permissions/deny"
|
||||
]
|
||||
]
|
||||
},
|
||||
"@libre.graph.permissions.roles.allowedValues": {
|
||||
|
||||
@@ -1252,6 +1252,28 @@ class GraphContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :byUser tries to search for user :searchTerm using Graph API
|
||||
* @When user :byUser searches for user :searchTerm using Graph API
|
||||
*
|
||||
* @param string $byUser
|
||||
* @param string $searchTerm
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userSearchesForUserUsingGraphApi(string $byUser, string $searchTerm): void {
|
||||
$credentials = $this->getAdminOrUserCredentials($byUser);
|
||||
$response = GraphHelper::searchUser(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$credentials['username'],
|
||||
$credentials['password'],
|
||||
$searchTerm,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to get all users using the Graph API
|
||||
* @When user :user gets all users using the Graph API
|
||||
@@ -1875,6 +1897,28 @@ class GraphContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to search for group :searchTerm using Graph API
|
||||
* @When user :user searches for group :searchTerm using Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $searchTerm
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userSearchesForGroupUsingGraphApi($user, $searchTerm):void {
|
||||
$credentials = $this->getAdminOrUserCredentials($user);
|
||||
$this->featureContext->setResponse(
|
||||
GraphHelper::searchGroup(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$credentials["username"],
|
||||
$credentials["password"],
|
||||
$searchTerm
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the JSON data of the response should (not )?contain the user "([^"]*)" in the item 'value'(?:, the user-details should match)?$/
|
||||
* @Then /^the JSON data of the response should (not )?contain the group "([^"]*)" in the item 'value'(?:, the group-details should match)?$/
|
||||
|
||||
Reference in New Issue
Block a user