mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
change: update unit tests for removing v1 format
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
- config:
|
||||
config:
|
||||
name: basic test with httpbin
|
||||
base_url: https://httpbin.org/
|
||||
|
||||
#- test:
|
||||
# TODO: fix compatibility with Python 2.7, UnicodeDecodeError
|
||||
# name: index
|
||||
# request:
|
||||
# url: /
|
||||
# method: GET
|
||||
# validate:
|
||||
# - eq: ["status_code", 200]
|
||||
# - contains: [content, "HTTP Request & Response Service"]
|
||||
|
||||
- test:
|
||||
teststeps:
|
||||
-
|
||||
name: headers
|
||||
request:
|
||||
url: /headers
|
||||
@@ -21,7 +12,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- eq: [content.headers.Host, "httpbin.org"]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: user-agent
|
||||
request:
|
||||
url: /user-agent
|
||||
@@ -30,7 +21,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- startswith: [content.user-agent, "python-requests"]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: get without params
|
||||
request:
|
||||
url: /get
|
||||
@@ -39,7 +30,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- eq: [content.args, {}]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: get with params in url
|
||||
request:
|
||||
url: /get?a=1&b=2
|
||||
@@ -48,7 +39,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- eq: [content.args, {'a': '1', 'b': '2'}]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: get with params in params field
|
||||
request:
|
||||
url: /get
|
||||
@@ -60,7 +51,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- eq: [content.args, {'a': '1', 'b': '2'}]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: set cookie
|
||||
request:
|
||||
url: /cookies/set?name=value
|
||||
@@ -69,7 +60,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
# - eq: [cookies.name, "value"]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: extract cookie
|
||||
request:
|
||||
url: /cookies
|
||||
@@ -78,7 +69,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
# - eq: [cookies.name, "value"]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: post data
|
||||
request:
|
||||
url: /post
|
||||
@@ -89,7 +80,7 @@
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: validate content length
|
||||
request:
|
||||
url: /spec.json
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- config:
|
||||
config:
|
||||
name: basic test with httpbin
|
||||
base_url: ${get_httpbin_server()}
|
||||
setup_hooks:
|
||||
@@ -6,7 +6,8 @@
|
||||
teardown_hooks:
|
||||
- ${hook_print(teardown)}
|
||||
|
||||
- test:
|
||||
teststeps:
|
||||
-
|
||||
name: headers
|
||||
request:
|
||||
url: /headers
|
||||
@@ -20,7 +21,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- contained_by: [content.headers.Host, "${get_httpbin_server()}"]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: alter response
|
||||
request:
|
||||
url: /headers
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
- config:
|
||||
config:
|
||||
name: load images
|
||||
base_url: ${get_httpbin_server()}
|
||||
|
||||
- test:
|
||||
teststeps:
|
||||
-
|
||||
name: get png image
|
||||
request:
|
||||
url: /image/png
|
||||
@@ -10,7 +11,7 @@
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: get jpeg image
|
||||
request:
|
||||
url: /image/jpeg
|
||||
@@ -18,7 +19,7 @@
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: get webp image
|
||||
request:
|
||||
url: /image/webp
|
||||
@@ -26,7 +27,7 @@
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: get svg image
|
||||
request:
|
||||
url: /image/svg
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
config:
|
||||
name: test upload file with httpbin
|
||||
base_url: ${get_httpbin_server()}
|
||||
|
||||
teststeps:
|
||||
-
|
||||
name: upload file
|
||||
variables:
|
||||
file_path: "data/test.env"
|
||||
m_encoder: ${multipart_encoder(file=$file_path)}
|
||||
request:
|
||||
url: /post
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: ${multipart_content_type($m_encoder)}
|
||||
data: $m_encoder
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- startswith: ["content.files.file", "UserName=test"]
|
||||
|
||||
-
|
||||
name: upload file with keyword
|
||||
request:
|
||||
url: /post
|
||||
method: POST
|
||||
upload:
|
||||
file: "data/test.env"
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- startswith: ["content.files.file", "UserName=test"]
|
||||
@@ -1,8 +1,9 @@
|
||||
- config:
|
||||
config:
|
||||
name: test upload file with httpbin
|
||||
base_url: ${get_httpbin_server()}
|
||||
|
||||
- test:
|
||||
teststeps:
|
||||
-
|
||||
name: upload file
|
||||
variables:
|
||||
file_path: "data/test.env"
|
||||
@@ -17,7 +18,7 @@
|
||||
- eq: ["status_code", 200]
|
||||
- startswith: ["content.files.file", "UserName=test"]
|
||||
|
||||
- test:
|
||||
-
|
||||
name: upload file with keyword
|
||||
request:
|
||||
url: /post
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
- config:
|
||||
config:
|
||||
name: basic test with httpbin
|
||||
base_url: http://httpbin.org/
|
||||
|
||||
- test:
|
||||
teststeps:
|
||||
-
|
||||
name: validate response with json path
|
||||
request:
|
||||
url: /get
|
||||
@@ -18,7 +19,7 @@
|
||||
- "assert status_code == 200"
|
||||
|
||||
|
||||
- test:
|
||||
-
|
||||
name: validate response with python script
|
||||
request:
|
||||
url: /get
|
||||
|
||||
Reference in New Issue
Block a user