mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
fix #64: when headers in test is None, it should inherit from config
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from httprunner import exception, runner, testcase
|
||||
|
||||
from httprunner import exception, runner, testcase, utils
|
||||
from tests.base import ApiServerUnittest
|
||||
|
||||
|
||||
@@ -132,3 +131,16 @@ class TestRunner(ApiServerUnittest):
|
||||
result = self.test_runner.run(testcase_file_path, variables_mapping)
|
||||
self.assertTrue(result["success"])
|
||||
self.assertIn("token", result["output"])
|
||||
|
||||
def test_run_testcase_with_empty_header(self):
|
||||
testcase_file_path = os.path.join(
|
||||
os.getcwd(), 'tests/data/test_bugfix.yml')
|
||||
testsets = testcase.load_testcases_by_path(testcase_file_path)
|
||||
testset = testsets[0]
|
||||
config_dict_headers = testset["config"]["request"]["headers"]
|
||||
test_dict_headers = testset["testcases"][0]["request"]["headers"]
|
||||
headers = utils.deep_update_dict(
|
||||
config_dict_headers,
|
||||
test_dict_headers
|
||||
)
|
||||
self.assertEqual(headers["Content-Type"], "application/json")
|
||||
|
||||
Reference in New Issue
Block a user