mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 23:41:22 +08:00
@@ -191,10 +191,11 @@ def load_dot_env_file():
|
|||||||
env_variables_mapping = {}
|
env_variables_mapping = {}
|
||||||
with io.open(path, 'r', encoding='utf-8') as fp:
|
with io.open(path, 'r', encoding='utf-8') as fp:
|
||||||
for line in fp:
|
for line in fp:
|
||||||
|
# maxsplit=1
|
||||||
if "=" in line:
|
if "=" in line:
|
||||||
variable, value = line.split("=")
|
variable, value = line.split("=", 1)
|
||||||
elif ":" in line:
|
elif ":" in line:
|
||||||
variable, value = line.split(":")
|
variable, value = line.split(":", 1)
|
||||||
else:
|
else:
|
||||||
raise exceptions.FileFormatError(".env format error")
|
raise exceptions.FileFormatError(".env format error")
|
||||||
|
|
||||||
|
|||||||
@@ -315,11 +315,11 @@
|
|||||||
{% elif validator.check_result == "unchecked" %}
|
{% elif validator.check_result == "unchecked" %}
|
||||||
<td class="unchecked">
|
<td class="unchecked">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{validator.check}}
|
{{validator.check | e}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{validator.comparator}}</td>
|
<td>{{validator.comparator}}</td>
|
||||||
<td>{{validator.expect}}</td>
|
<td>{{validator.expect | e}}</td>
|
||||||
<td>{{validator.check_value}}</td>
|
<td>{{validator.check_value | e}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
UserName=test
|
UserName=test
|
||||||
Password=654321
|
Password=654321
|
||||||
PROJECT_KEY=AAABBBCCC
|
PROJECT_KEY=AAABBBCCC
|
||||||
|
content_type=application/json; charset=UTF-8
|
||||||
@@ -173,7 +173,7 @@ class TestHttpRunner(ApiServerUnittest):
|
|||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
summary = runner.summary
|
summary = runner.summary
|
||||||
self.assertTrue(summary["success"])
|
self.assertTrue(summary["success"])
|
||||||
self.assertLess(end_time - start_time, 20)
|
self.assertLess(end_time - start_time, 60)
|
||||||
|
|
||||||
def test_run_httprunner_with_teardown_hooks_alter_response(self):
|
def test_run_httprunner_with_teardown_hooks_alter_response(self):
|
||||||
testcases = [
|
testcases = [
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ class TestFileLoader(unittest.TestCase):
|
|||||||
env_variables_mapping = loader.load_dot_env_file()
|
env_variables_mapping = loader.load_dot_env_file()
|
||||||
self.assertIn("PROJECT_KEY", env_variables_mapping)
|
self.assertIn("PROJECT_KEY", env_variables_mapping)
|
||||||
self.assertEqual(env_variables_mapping["UserName"], "test")
|
self.assertEqual(env_variables_mapping["UserName"], "test")
|
||||||
|
self.assertEqual(env_variables_mapping["content_type"], "application/json; charset=UTF-8")
|
||||||
loader.dot_env_path = None
|
loader.dot_env_path = None
|
||||||
|
|
||||||
def test_load_env_path_not_exist(self):
|
def test_load_env_path_not_exist(self):
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class TestResponse(ApiServerUnittest):
|
|||||||
]
|
]
|
||||||
extract_binds_dict = resp_obj.extract_response(extract_binds_list)
|
extract_binds_dict = resp_obj.extract_response(extract_binds_list)
|
||||||
self.assertGreater(extract_binds_dict["resp_elapsed_microseconds"], 1000)
|
self.assertGreater(extract_binds_dict["resp_elapsed_microseconds"], 1000)
|
||||||
self.assertLess(extract_binds_dict["resp_elapsed_seconds"], 10)
|
self.assertLess(extract_binds_dict["resp_elapsed_seconds"], 60)
|
||||||
self.assertEqual(extract_binds_dict["resp_elapsed_days"], 0)
|
self.assertEqual(extract_binds_dict["resp_elapsed_days"], 0)
|
||||||
self.assertGreater(extract_binds_dict["resp_elapsed_total_seconds"], 0)
|
self.assertGreater(extract_binds_dict["resp_elapsed_total_seconds"], 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user