-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add e2e test cases of user, role, and plugin (#4920)
* chore: provide an out-of-the-box gitpod config file * test: add e2e test cases of user, role, and plugin --------- Co-authored-by: rick <[email protected]> Co-authored-by: John Niang <[email protected]>
- Loading branch information
1 parent
99edbdd
commit ce5c1f9
Showing
6 changed files
with
183 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,6 @@ nbdist/ | |
|
||
### VSCode | ||
.vscode | ||
.gitpod.yml | ||
|
||
### Local file | ||
application-local.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This configuration file was automatically generated by Gitpod. | ||
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) | ||
# and commit this file to your remote git repository to share the goodness with others. | ||
|
||
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart | ||
|
||
tasks: | ||
- init: ./gradlew clean build -x check && sdk install java 17.0.3-ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ api: | | |
param: | ||
postName: "{{randAlpha 6}}" | ||
userName: "{{randAlpha 6}}" | ||
roleName: "{{randAlpha 6}}" | ||
notificationName: "{{randAlpha 6}}" | ||
auth: "Basic YWRtaW46MTIzNDU2" | ||
items: | ||
|
@@ -28,7 +29,7 @@ items: | |
api: /api.console.halo.run/v1alpha1/posts | ||
method: POST | ||
header: | ||
Authorization: "Basic YWRtaW46MTIzNDU2" | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
|
@@ -71,7 +72,7 @@ items: | |
request: | ||
api: /api.console.halo.run/v1alpha1/posts?keyword={{.param.postName}} | ||
header: | ||
Authorization: "Basic YWRtaW46MTIzNDU2" | ||
Authorization: "{{.param.auth}}" | ||
expect: | ||
verify: | ||
- data.total == 1 | ||
|
@@ -80,13 +81,171 @@ items: | |
api: /api.console.halo.run/v1alpha1/posts/{{(index .listPosts.items 0).post.metadata.name}}/recycle | ||
method: PUT | ||
header: | ||
Authorization: "Basic YWRtaW46MTIzNDU2" | ||
Authorization: "{{.param.auth}}" | ||
- name: recover | ||
request: | ||
api: /content.halo.run/v1alpha1/posts/{{(index .listPosts.items 0).post.metadata.name}} | ||
method: DELETE | ||
header: | ||
Authorization: "Basic YWRtaW46MTIzNDU2" | ||
Authorization: "{{.param.auth}}" | ||
|
||
## Users | ||
- name: createUser | ||
request: | ||
api: /api.console.halo.run/v1alpha1/users | ||
method: POST | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"avatar": "", | ||
"bio": "{{randAlpha 6}}", | ||
"displayName": "{{randAlpha 6}}", | ||
"email": "[email protected]", | ||
"name": "{{.param.userName}}", | ||
"password": "{{randAlpha 6}}", | ||
"phone": "", | ||
"roles": [] | ||
} | ||
- name: updateUserPass | ||
request: | ||
api: /api.console.halo.run/v1alpha1/users/{{.param.userName}}/password | ||
method: PUT | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"password": "{{randAlpha 3}}" | ||
} | ||
- name: grantPermission | ||
request: | ||
api: /api.console.halo.run/v1alpha1/users/{{.param.userName}}/permissions | ||
method: POST | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"roles": [ | ||
"guest" | ||
] | ||
} | ||
- name: deleteUser | ||
request: | ||
api: | | ||
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/users/{{.param.userName}} | ||
method: DELETE | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
|
||
## Roles | ||
- name: createRole | ||
request: | ||
api: | | ||
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/roles | ||
method: POST | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"apiVersion": "v1alpha1", | ||
"kind": "Role", | ||
"metadata": { | ||
"name": "", | ||
"generateName": "role-", | ||
"labels": {}, | ||
"annotations": { | ||
"rbac.authorization.halo.run/dependencies": "[\"role-template-manage-appstore\"]", | ||
"rbac.authorization.halo.run/display-name": "{{.param.roleName}}" | ||
} | ||
}, | ||
"rules": [] | ||
} | ||
expect: | ||
statusCode: 201 | ||
- name: listRoles | ||
request: | ||
api: | | ||
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/roles | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
expect: | ||
verify: | ||
- data.total >= 3 | ||
- name: deleteRole | ||
request: | ||
api: | | ||
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/roles/{{(index .listRoles.items 0).metadata.name}} | ||
method: DELETE | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
|
||
## Plugins | ||
- name: installPlugin | ||
request: | ||
api: /api.console.halo.run/v1alpha1/plugins/-/install-from-uri | ||
method: POST | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"uri": "https://github.com/Stonewuu/halo-plugin-sitepush/releases/download/1.3.1/halo-plugin-sitepush-1.3.1.jar" | ||
} | ||
- name: pluginList | ||
request: | ||
api: /api.console.halo.run/v1alpha1/plugins | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
expect: | ||
verify: | ||
- data.total >= 1 | ||
- name: inActivePlugins | ||
request: | ||
api: /api.console.halo.run/v1alpha1/plugins?enabled=false&keyword=&page=0&size=0 | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
expect: | ||
verify: | ||
- data.total == 1 | ||
- name: disablePlugin | ||
request: | ||
api: /api.console.halo.run/v1alpha1/plugins/PluginSitePush/plugin-state | ||
method: PUT | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"enable": false | ||
} | ||
- name: enablePlugin | ||
request: | ||
api: /api.console.halo.run/v1alpha1/plugins/PluginSitePush/plugin-state | ||
method: PUT | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"enable": true | ||
} | ||
- name: resetPlugin | ||
request: | ||
api: /api.console.halo.run/v1alpha1/plugins/PluginSitePush/reset-config | ||
method: PUT | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
Content-Type: application/json | ||
- name: uninstallPlugin | ||
request: | ||
api: /plugin.halo.run/v1alpha1/plugins/PluginSitePush | ||
method: DELETE | ||
header: | ||
Authorization: "{{.param.auth}}" | ||
|
||
# Notifications | ||
- name: createNotification | ||
|