api-testing/sample/testsuite-gitlab.yaml

36 lines
877 B
YAML

#!api-testing
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
# https://docs.gitlab.com/ee/api/api_resources.html
name: Gitlab
api: https://gitlab.com/api/v4
param:
user: linuxsuren
items:
- name: projects
request:
api: /projects
expect:
statusCode: 200
schema: |
{
"type": "array"
}
before:
items:
- "sleep(1)"
after:
items:
- "sleep(1)"
- name: project
request:
api: /projects/{{int64 (index .projects 0).id}}
expect:
statusCode: 200
# bodyFieldsExpect:
# http_url_to_repo: https://gitlab.com/senghuy/sr_chea_senghuy_spring_homework001.git
verify:
- data.http_url_to_repo startsWith "https"
- data.http_url_to_repo endsWith ".git"
- data.default_branch == 'master' or data.default_branch == 'main'
- len(data.topics) >= 0