Skip to content

Commit 813750b

Browse files
committed
test: Add public page endpoints
Signed-off-by: provokateurin <[email protected]>
1 parent 41d1f54 commit 813750b

File tree

4 files changed

+315
-0
lines changed

4 files changed

+315
-0
lines changed

tests/appinfo/routes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
['name' => 'Settings#samePathPost', 'url' => '/api/{apiVersion}/same-path', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
8989
['name' => 'Settings#requestHeader', 'url' => '/api/{apiVersion}/request-header', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
9090
['name' => 'Settings#requestParams', 'url' => '/api/{apiVersion}/request-params', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
91+
['name' => 'Settings#publicPageAnnotation', 'url' => '/api/{apiVersion}/public-page/annotation', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
92+
['name' => 'Settings#publicPageAttribute', 'url' => '/api/{apiVersion}/public-page/attribute', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
9193
['name' => 'V1\SubDir#subDirRoute', 'url' => '/sub-dir', 'verb' => 'GET'],
9294
],
9395
];

tests/lib/Controller/SettingsController.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
1616
use OCP\AppFramework\Http\Attribute\OpenAPI;
1717
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
18+
use OCP\AppFramework\Http\Attribute\PublicPage;
1819
use OCP\AppFramework\Http\Attribute\RequestHeader;
1920
use OCP\AppFramework\Http\DataResponse;
2021
use OCP\AppFramework\OCS\OCSNotFoundException;
@@ -790,4 +791,28 @@ public function requestParams(): DataResponse {
790791

791792
return new DataResponse();
792793
}
794+
795+
/**
796+
* A public page with annotation.
797+
*
798+
* @PublicPage
799+
* @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
800+
*
801+
* 200: Admin settings updated
802+
*/
803+
public function publicPageAnnotation(): DataResponse {
804+
return new DataResponse();
805+
}
806+
807+
/**
808+
* A public page with attribute.
809+
*
810+
* @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
811+
*
812+
* 200: Admin settings updated
813+
*/
814+
#[PublicPage]
815+
public function publicPageAttribute(): DataResponse {
816+
return new DataResponse();
817+
}
793818
}

tests/openapi-full.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6880,6 +6880,150 @@
68806880
}
68816881
}
68826882
},
6883+
"/ocs/v2.php/apps/notifications/api/{apiVersion}/public-page/annotation": {
6884+
"post": {
6885+
"operationId": "settings-public-page-annotation",
6886+
"summary": "A public page with annotation.",
6887+
"tags": [
6888+
"settings"
6889+
],
6890+
"security": [
6891+
{},
6892+
{
6893+
"bearer_auth": []
6894+
},
6895+
{
6896+
"basic_auth": []
6897+
}
6898+
],
6899+
"parameters": [
6900+
{
6901+
"name": "apiVersion",
6902+
"in": "path",
6903+
"required": true,
6904+
"schema": {
6905+
"type": "string",
6906+
"enum": [
6907+
"v2"
6908+
],
6909+
"default": "v2"
6910+
}
6911+
},
6912+
{
6913+
"name": "OCS-APIRequest",
6914+
"in": "header",
6915+
"description": "Required to be true for the API request to pass",
6916+
"required": true,
6917+
"schema": {
6918+
"type": "boolean",
6919+
"default": true
6920+
}
6921+
}
6922+
],
6923+
"responses": {
6924+
"200": {
6925+
"description": "Admin settings updated",
6926+
"content": {
6927+
"application/json": {
6928+
"schema": {
6929+
"type": "object",
6930+
"required": [
6931+
"ocs"
6932+
],
6933+
"properties": {
6934+
"ocs": {
6935+
"type": "object",
6936+
"required": [
6937+
"meta",
6938+
"data"
6939+
],
6940+
"properties": {
6941+
"meta": {
6942+
"$ref": "#/components/schemas/OCSMeta"
6943+
},
6944+
"data": {}
6945+
}
6946+
}
6947+
}
6948+
}
6949+
}
6950+
}
6951+
}
6952+
}
6953+
}
6954+
},
6955+
"/ocs/v2.php/apps/notifications/api/{apiVersion}/public-page/attribute": {
6956+
"post": {
6957+
"operationId": "settings-public-page-attribute",
6958+
"summary": "A public page with attribute.",
6959+
"tags": [
6960+
"settings"
6961+
],
6962+
"security": [
6963+
{},
6964+
{
6965+
"bearer_auth": []
6966+
},
6967+
{
6968+
"basic_auth": []
6969+
}
6970+
],
6971+
"parameters": [
6972+
{
6973+
"name": "apiVersion",
6974+
"in": "path",
6975+
"required": true,
6976+
"schema": {
6977+
"type": "string",
6978+
"enum": [
6979+
"v2"
6980+
],
6981+
"default": "v2"
6982+
}
6983+
},
6984+
{
6985+
"name": "OCS-APIRequest",
6986+
"in": "header",
6987+
"description": "Required to be true for the API request to pass",
6988+
"required": true,
6989+
"schema": {
6990+
"type": "boolean",
6991+
"default": true
6992+
}
6993+
}
6994+
],
6995+
"responses": {
6996+
"200": {
6997+
"description": "Admin settings updated",
6998+
"content": {
6999+
"application/json": {
7000+
"schema": {
7001+
"type": "object",
7002+
"required": [
7003+
"ocs"
7004+
],
7005+
"properties": {
7006+
"ocs": {
7007+
"type": "object",
7008+
"required": [
7009+
"meta",
7010+
"data"
7011+
],
7012+
"properties": {
7013+
"meta": {
7014+
"$ref": "#/components/schemas/OCSMeta"
7015+
},
7016+
"data": {}
7017+
}
7018+
}
7019+
}
7020+
}
7021+
}
7022+
}
7023+
}
7024+
}
7025+
}
7026+
},
68837027
"/ocs/v2.php/apps/notifications/sub-dir": {
68847028
"get": {
68857029
"operationId": "v1_sub_dir-sub-dir-route",

tests/openapi.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,150 @@
10571057
}
10581058
}
10591059
},
1060+
"/ocs/v2.php/apps/notifications/api/{apiVersion}/public-page/annotation": {
1061+
"post": {
1062+
"operationId": "settings-public-page-annotation",
1063+
"summary": "A public page with annotation.",
1064+
"tags": [
1065+
"settings"
1066+
],
1067+
"security": [
1068+
{},
1069+
{
1070+
"bearer_auth": []
1071+
},
1072+
{
1073+
"basic_auth": []
1074+
}
1075+
],
1076+
"parameters": [
1077+
{
1078+
"name": "apiVersion",
1079+
"in": "path",
1080+
"required": true,
1081+
"schema": {
1082+
"type": "string",
1083+
"enum": [
1084+
"v2"
1085+
],
1086+
"default": "v2"
1087+
}
1088+
},
1089+
{
1090+
"name": "OCS-APIRequest",
1091+
"in": "header",
1092+
"description": "Required to be true for the API request to pass",
1093+
"required": true,
1094+
"schema": {
1095+
"type": "boolean",
1096+
"default": true
1097+
}
1098+
}
1099+
],
1100+
"responses": {
1101+
"200": {
1102+
"description": "Admin settings updated",
1103+
"content": {
1104+
"application/json": {
1105+
"schema": {
1106+
"type": "object",
1107+
"required": [
1108+
"ocs"
1109+
],
1110+
"properties": {
1111+
"ocs": {
1112+
"type": "object",
1113+
"required": [
1114+
"meta",
1115+
"data"
1116+
],
1117+
"properties": {
1118+
"meta": {
1119+
"$ref": "#/components/schemas/OCSMeta"
1120+
},
1121+
"data": {}
1122+
}
1123+
}
1124+
}
1125+
}
1126+
}
1127+
}
1128+
}
1129+
}
1130+
}
1131+
},
1132+
"/ocs/v2.php/apps/notifications/api/{apiVersion}/public-page/attribute": {
1133+
"post": {
1134+
"operationId": "settings-public-page-attribute",
1135+
"summary": "A public page with attribute.",
1136+
"tags": [
1137+
"settings"
1138+
],
1139+
"security": [
1140+
{},
1141+
{
1142+
"bearer_auth": []
1143+
},
1144+
{
1145+
"basic_auth": []
1146+
}
1147+
],
1148+
"parameters": [
1149+
{
1150+
"name": "apiVersion",
1151+
"in": "path",
1152+
"required": true,
1153+
"schema": {
1154+
"type": "string",
1155+
"enum": [
1156+
"v2"
1157+
],
1158+
"default": "v2"
1159+
}
1160+
},
1161+
{
1162+
"name": "OCS-APIRequest",
1163+
"in": "header",
1164+
"description": "Required to be true for the API request to pass",
1165+
"required": true,
1166+
"schema": {
1167+
"type": "boolean",
1168+
"default": true
1169+
}
1170+
}
1171+
],
1172+
"responses": {
1173+
"200": {
1174+
"description": "Admin settings updated",
1175+
"content": {
1176+
"application/json": {
1177+
"schema": {
1178+
"type": "object",
1179+
"required": [
1180+
"ocs"
1181+
],
1182+
"properties": {
1183+
"ocs": {
1184+
"type": "object",
1185+
"required": [
1186+
"meta",
1187+
"data"
1188+
],
1189+
"properties": {
1190+
"meta": {
1191+
"$ref": "#/components/schemas/OCSMeta"
1192+
},
1193+
"data": {}
1194+
}
1195+
}
1196+
}
1197+
}
1198+
}
1199+
}
1200+
}
1201+
}
1202+
}
1203+
},
10601204
"/ocs/v2.php/apps/notifications/sub-dir": {
10611205
"get": {
10621206
"operationId": "v1_sub_dir-sub-dir-route",

0 commit comments

Comments
 (0)