All checks were successful
Build and Push to Private Registry101 / build (push) Successful in 33s
86 lines
2.0 KiB
YAML
86 lines
2.0 KiB
YAML
# Test using included Django test app
|
|
# First install python-django
|
|
# Then launch the app in another terminal by doing
|
|
# cd testapp
|
|
# python manage.py testserver test_data.json
|
|
# Once launched, tests can be executed via:
|
|
# python resttest.py http://localhost:8000 miniapp-test.yaml
|
|
---
|
|
- config:
|
|
- testset: "Tests using test app"
|
|
- variable_binds:
|
|
- 'uid': 1
|
|
- 'post_id': 1
|
|
|
|
- test: # create entity
|
|
- name: "Basic get"
|
|
- url: "/"
|
|
- test: # create entity
|
|
- name: "Get version"
|
|
- url: "/version"
|
|
|
|
|
|
- test: # create person by POST
|
|
- name: "Create person"
|
|
- url: "/users"
|
|
- method: "POST"
|
|
- body: '{"name": "Willim","email": "theadmiral@gmail.com"}'
|
|
- headers: {Content-Type: application/json}
|
|
- extract_binds:
|
|
- 'uid' : {'jsonpath_mini': "user.id"}
|
|
|
|
- test: # get single person
|
|
- name: "Get single person"
|
|
- url: {'template':'/users/$uid'} # use binded value
|
|
- method: 'GET'
|
|
|
|
- test: # update person by PUT
|
|
- name: "update person by PUT"
|
|
- url: {'template':'/users/$uid'}
|
|
- method: "PUT"
|
|
- body: '{"name": "Gaius"}'
|
|
- headers: {'Content-Type': 'application/json'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- test: # create post by POST
|
|
- name: "Create post"
|
|
- url: "/posts"
|
|
- method: "POST"
|
|
- body: '{"title": "Willims post","content": "william made a post","author_id": 1}'
|
|
- headers: {Content-Type: application/json}
|
|
- extract_binds:
|
|
- 'post_id' : {'jsonpath_mini': "post.id"}
|
|
|
|
- test: # get single post
|
|
- name: "Get single post"
|
|
- url: {'template':'/posts/$post_id'}
|
|
- method: 'GET'
|
|
|
|
- test: # update post by PUT
|
|
- name: "update post by PUT"
|
|
- url: {'template':'/posts/$post_id'}
|
|
- method: "PUT"
|
|
- body: '{"title": "Gaius made a post"}'
|
|
- headers: {'Content-Type': 'application/json'}
|
|
- test: # delete post
|
|
- name: "Delete post"
|
|
- url: {'template':'/posts/$post_id'}
|
|
- method: "DELETE"
|
|
|
|
|
|
|
|
|
|
|
|
- test: # delete person
|
|
- name: "Delete person"
|
|
- url: {'template':'/users/$uid'}
|
|
- method: "DELETE"
|
|
|
|
|
|
|