mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: change httpbin.org from http to https
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
config:
|
config:
|
||||||
name: basic test with httpbin
|
name: basic test with httpbin
|
||||||
base_url: http://httpbin.org/
|
base_url: https://httpbin.org/
|
||||||
|
|
||||||
teststeps:
|
teststeps:
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from httprunner import HttpRunner, Config, Step, RunRequest
|
|||||||
|
|
||||||
class TestCaseValidate(HttpRunner):
|
class TestCaseValidate(HttpRunner):
|
||||||
|
|
||||||
config = Config("basic test with httpbin").base_url("http://httpbin.org/")
|
config = Config("basic test with httpbin").base_url("https://httpbin.org/")
|
||||||
|
|
||||||
teststeps = [
|
teststeps = [
|
||||||
Step(
|
Step(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ func TestBoomerStandaloneRun(t *testing.T) {
|
|||||||
defer removeHashicorpGoPlugin()
|
defer removeHashicorpGoPlugin()
|
||||||
|
|
||||||
testcase1 := &TestCase{
|
testcase1 := &TestCase{
|
||||||
Config: NewConfig("TestCase1").SetBaseURL("http://httpbin.org"),
|
Config: NewConfig("TestCase1").SetBaseURL("https://httpbin.org"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("headers").
|
NewStep("headers").
|
||||||
GET("/headers").
|
GET("/headers").
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestLoadCurlCase(t *testing.T) {
|
|||||||
if !assert.EqualValues(t, "GET", tCase.TestSteps[0].Request.Method) {
|
if !assert.EqualValues(t, "GET", tCase.TestSteps[0].Request.Method) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
if !assert.Equal(t, "http://httpbin.org", tCase.TestSteps[0].Request.URL) {
|
if !assert.Equal(t, "https://httpbin.org", tCase.TestSteps[0].Request.URL) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func assertRunTestCases(t *testing.T) {
|
|||||||
refCase := TestCasePath(demoTestCaseWithPluginJSONPath)
|
refCase := TestCasePath(demoTestCaseWithPluginJSONPath)
|
||||||
testcase1 := &TestCase{
|
testcase1 := &TestCase{
|
||||||
Config: NewConfig("TestCase1").
|
Config: NewConfig("TestCase1").
|
||||||
SetBaseURL("http://httpbin.org"),
|
SetBaseURL("https://httpbin.org"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("testcase1-step1").
|
NewStep("testcase1-step1").
|
||||||
GET("/headers").
|
GET("/headers").
|
||||||
@@ -77,7 +77,7 @@ func assertRunTestCases(t *testing.T) {
|
|||||||
AssertEqual("headers.\"Content-Type\"", "application/json", "check http response Content-Type"),
|
AssertEqual("headers.\"Content-Type\"", "application/json", "check http response Content-Type"),
|
||||||
NewStep("testcase1-step3").CallRefCase(
|
NewStep("testcase1-step3").CallRefCase(
|
||||||
&TestCase{
|
&TestCase{
|
||||||
Config: NewConfig("testcase1-step3-ref-case").SetBaseURL("http://httpbin.org"),
|
Config: NewConfig("testcase1-step3-ref-case").SetBaseURL("https://httpbin.org"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("ip").
|
NewStep("ip").
|
||||||
GET("/ip").
|
GET("/ip").
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ func TestRunRequestStatOn(t *testing.T) {
|
|||||||
if !assert.Greater(t, stat["Total"], int64(1)) {
|
if !assert.Greater(t, stat["Total"], int64(1)) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
if !assert.Less(t, stat["Total"]-summary.Records[0].Elapsed, int64(3)) {
|
if !assert.Less(t, stat["Total"]-summary.Records[0].Elapsed, int64(100)) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,7 +165,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
|
|||||||
testcase1 := &TestCase{
|
testcase1 := &TestCase{
|
||||||
Config: NewConfig("TestCase1").
|
Config: NewConfig("TestCase1").
|
||||||
SetTimeout(2 * time.Second). // set global timeout to 2s
|
SetTimeout(2 * time.Second). // set global timeout to 2s
|
||||||
SetBaseURL("http://httpbin.org"),
|
SetBaseURL("https://httpbin.org"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("step1").
|
NewStep("step1").
|
||||||
GET("/delay/1").
|
GET("/delay/1").
|
||||||
@@ -181,7 +181,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
|
|||||||
testcase2 := &TestCase{
|
testcase2 := &TestCase{
|
||||||
Config: NewConfig("TestCase2").
|
Config: NewConfig("TestCase2").
|
||||||
SetTimeout(2 * time.Second). // set global timeout to 2s
|
SetTimeout(2 * time.Second). // set global timeout to 2s
|
||||||
SetBaseURL("http://httpbin.org"),
|
SetBaseURL("https://httpbin.org"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("step1").
|
NewStep("step1").
|
||||||
GET("/delay/3").
|
GET("/delay/3").
|
||||||
@@ -198,7 +198,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
|
|||||||
testcase3 := &TestCase{
|
testcase3 := &TestCase{
|
||||||
Config: NewConfig("TestCase3").
|
Config: NewConfig("TestCase3").
|
||||||
SetTimeout(2 * time.Second).
|
SetTimeout(2 * time.Second).
|
||||||
SetBaseURL("http://httpbin.org"),
|
SetBaseURL("https://httpbin.org"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("step2").
|
NewStep("step2").
|
||||||
GET("/delay/3").
|
GET("/delay/3").
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class TestHttpSession(unittest.TestCase):
|
|||||||
self.session = HttpSession()
|
self.session = HttpSession()
|
||||||
|
|
||||||
def test_request_http(self):
|
def test_request_http(self):
|
||||||
self.session.request("get", "http://httpbin.org/get")
|
self.session.request("get", "https://httpbin.org/get")
|
||||||
address = self.session.data.address
|
address = self.session.data.address
|
||||||
self.assertGreater(len(address.server_ip), 0)
|
self.assertGreater(len(address.server_ip), 0)
|
||||||
self.assertEqual(address.server_port, 80)
|
self.assertEqual(address.server_port, 80)
|
||||||
@@ -26,7 +26,7 @@ class TestHttpSession(unittest.TestCase):
|
|||||||
def test_request_http_allow_redirects(self):
|
def test_request_http_allow_redirects(self):
|
||||||
self.session.request(
|
self.session.request(
|
||||||
"get",
|
"get",
|
||||||
"http://httpbin.org/redirect-to?url=https%3A%2F%2Fgithub.com",
|
"https://httpbin.org/redirect-to?url=https%3A%2F%2Fgithub.com",
|
||||||
allow_redirects=True,
|
allow_redirects=True,
|
||||||
)
|
)
|
||||||
address = self.session.data.address
|
address = self.session.data.address
|
||||||
@@ -50,7 +50,7 @@ class TestHttpSession(unittest.TestCase):
|
|||||||
def test_request_http_not_allow_redirects(self):
|
def test_request_http_not_allow_redirects(self):
|
||||||
self.session.request(
|
self.session.request(
|
||||||
"get",
|
"get",
|
||||||
"http://httpbin.org/redirect-to?url=https%3A%2F%2Fgithub.com",
|
"https://httpbin.org/redirect-to?url=https%3A%2F%2Fgithub.com",
|
||||||
allow_redirects=False,
|
allow_redirects=False,
|
||||||
)
|
)
|
||||||
address = self.session.data.address
|
address = self.session.data.address
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Then you can write upload test script as below:
|
|||||||
- test:
|
- test:
|
||||||
name: upload file
|
name: upload file
|
||||||
request:
|
request:
|
||||||
url: http://httpbin.org/upload
|
url: https://httpbin.org/upload
|
||||||
method: POST
|
method: POST
|
||||||
headers:
|
headers:
|
||||||
Cookie: session=AAA-BBB-CCC
|
Cookie: session=AAA-BBB-CCC
|
||||||
@@ -31,7 +31,7 @@ For compatibility, you can also write upload test script in old way:
|
|||||||
field2: "value2"
|
field2: "value2"
|
||||||
m_encoder: ${multipart_encoder(file=$file, field1=$field1, field2=$field2)}
|
m_encoder: ${multipart_encoder(file=$file, field1=$field1, field2=$field2)}
|
||||||
request:
|
request:
|
||||||
url: http://httpbin.org/upload
|
url: https://httpbin.org/upload
|
||||||
method: POST
|
method: POST
|
||||||
headers:
|
headers:
|
||||||
Content-Type: ${multipart_content_type($m_encoder)}
|
Content-Type: ${multipart_content_type($m_encoder)}
|
||||||
@@ -75,7 +75,9 @@ def ensure_upload_ready():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def prepare_upload_step(step: TStep, step_variables: VariablesMapping, functions: FunctionsMapping):
|
def prepare_upload_step(
|
||||||
|
step: TStep, step_variables: VariablesMapping, functions: FunctionsMapping
|
||||||
|
):
|
||||||
"""preprocess for upload test
|
"""preprocess for upload test
|
||||||
replace `upload` info with MultipartEncoder
|
replace `upload` info with MultipartEncoder
|
||||||
|
|
||||||
@@ -84,7 +86,7 @@ def prepare_upload_step(step: TStep, step_variables: VariablesMapping, functions
|
|||||||
{
|
{
|
||||||
"variables": {},
|
"variables": {},
|
||||||
"request": {
|
"request": {
|
||||||
"url": "http://httpbin.org/upload",
|
"url": "https://httpbin.org/upload",
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"headers": {
|
"headers": {
|
||||||
"Cookie": "session=AAA-BBB-CCC"
|
"Cookie": "session=AAA-BBB-CCC"
|
||||||
|
|||||||
Reference in New Issue
Block a user