File tree Expand file tree Collapse file tree 4 files changed +1856
-0
lines changed Expand file tree Collapse file tree 4 files changed +1856
-0
lines changed Original file line number Diff line number Diff line change 1+ # httpbin.org REST API
2+
3+ [ httpbin.org] ( https://httpbin.org ) is a simple HTTP Request & Response Service.
4+
5+ ## Run
6+
7+ Requirements:
8+ - [ ScanAPI] ( https://pypi.org/project/scanapi/ )
9+
10+ ``` shell
11+ $ git clone git@github.com:scanapi/examples.git
12+ $ cd httpbin-api
13+ $ scanapi run httpbin.yaml
14+ ```
15+
16+ The report will be available at ` scanapi-report.html `
Original file line number Diff line number Diff line change 1+ endpoints :
2+ - name : httpbin
3+ path : https://httpbin.org
4+ headers :
5+ Accept : application/json
6+ requests :
7+ - name : get-simple
8+ path : /get
9+ method : get
10+
11+ - name : get-image
12+ path : /image/png
13+ headers :
14+ Accept : image/png
15+ method : get
16+ tests :
17+ - name : status_code_is_200
18+ assert : ${{ response.status_code == 200 }}
19+ - name : content_type_is_png
20+ assert : ${{ response.headers.get("content-type") == "image/png" }}
21+
22+ - name : post-simple
23+ path : /post
24+ method : post
25+ vars :
26+ scanapi_var : scanapi_test1
27+ body :
28+ description : hello scanapi
29+ scanapi_test : ${scanapi_var}
30+ tests :
31+ - name : status_code_is_200
32+ assert : ${{ response.status_code == 200 }}
33+ - name : body_is_ok
34+ assert : ${{ response.json()["json"].get("scanapi_test") == "${scanapi_var}" }}
35+ - name : response_origin
36+ assert : ${{ response.json()["origin"] is not None }}
37+
38+ - name : put-simple
39+ path : /put
40+ method : put
41+ vars :
42+ scanapi_description : hello scanapi again
43+ body :
44+ description : ${scanapi_description}
45+ tests :
46+ - name : status_code_is_200
47+ assert : ${{ response.status_code == 200 }}
48+ - name : description_changed
49+ assert : ${{ response.json()["json"].get("description") == "${scanapi_description}" }}
50+
51+ - name : delete-simple
52+ path : /delete
53+ method : delete
54+ tests :
55+ - name : status_code_is_200
56+ assert : ${{ response.status_code == 200 }}
You can’t perform that action at this time.
0 commit comments