mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 22:44:05 +08:00
change: move HTTP_BIN_URL to utils
This commit is contained in:
@@ -6,7 +6,7 @@ import uuid
|
|||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from httprunner.utils_test import HTTP_BIN_URL
|
from httprunner.utils import HTTP_BIN_URL
|
||||||
|
|
||||||
|
|
||||||
def get_httpbin_server():
|
def get_httpbin_server():
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from httprunner.client import HttpSession
|
from httprunner.client import HttpSession
|
||||||
from httprunner.utils_test import HTTP_BIN_URL
|
from httprunner.utils import HTTP_BIN_URL
|
||||||
|
|
||||||
|
|
||||||
class TestHttpSession(unittest.TestCase):
|
class TestHttpSession(unittest.TestCase):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from httprunner import compat, exceptions, loader
|
from httprunner import compat, exceptions, loader
|
||||||
from httprunner.utils_test import HTTP_BIN_URL
|
from httprunner.utils import HTTP_BIN_URL
|
||||||
|
|
||||||
|
|
||||||
class TestCompat(unittest.TestCase):
|
class TestCompat(unittest.TestCase):
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import requests
|
|||||||
|
|
||||||
from httprunner.parser import Parser
|
from httprunner.parser import Parser
|
||||||
from httprunner.response import ResponseObject, uniform_validator
|
from httprunner.response import ResponseObject, uniform_validator
|
||||||
from httprunner.utils_test import HTTP_BIN_URL
|
from httprunner.utils import HTTP_BIN_URL
|
||||||
|
|
||||||
|
|
||||||
class TestResponse(unittest.TestCase):
|
class TestResponse(unittest.TestCase):
|
||||||
|
|||||||
@@ -20,6 +20,15 @@ from httprunner import __version__, exceptions
|
|||||||
from httprunner.models import VariablesMapping
|
from httprunner.models import VariablesMapping
|
||||||
|
|
||||||
|
|
||||||
|
""" run httpbin as test service
|
||||||
|
https://github.com/postmanlabs/httpbin
|
||||||
|
|
||||||
|
$ docker pull kennethreitz/httpbin
|
||||||
|
$ docker run -p 80:80 kennethreitz/httpbin
|
||||||
|
"""
|
||||||
|
HTTP_BIN_URL = "http://127.0.0.1:80"
|
||||||
|
|
||||||
|
|
||||||
def get_platform():
|
def get_platform():
|
||||||
return {
|
return {
|
||||||
"httprunner_version": __version__,
|
"httprunner_version": __version__,
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ from httprunner import __version__, loader, utils
|
|||||||
from httprunner.utils import ExtendJSONEncoder, merge_variables, ga4_client
|
from httprunner.utils import ExtendJSONEncoder, merge_variables, ga4_client
|
||||||
|
|
||||||
|
|
||||||
HTTP_BIN_URL = "http://127.0.0.1:80"
|
|
||||||
|
|
||||||
|
|
||||||
class TestUtils(unittest.TestCase):
|
class TestUtils(unittest.TestCase):
|
||||||
def test_set_os_environ(self):
|
def test_set_os_environ(self):
|
||||||
self.assertNotIn("abc", os.environ)
|
self.assertNotIn("abc", os.environ)
|
||||||
@@ -124,10 +121,10 @@ class TestUtils(unittest.TestCase):
|
|||||||
|
|
||||||
def test_override_config_variables(self):
|
def test_override_config_variables(self):
|
||||||
step_variables = {"base_url": "$base_url", "foo1": "bar1"}
|
step_variables = {"base_url": "$base_url", "foo1": "bar1"}
|
||||||
config_variables = {"base_url": HTTP_BIN_URL, "foo1": "bar111"}
|
config_variables = {"base_url": "https://httpbin.org", "foo1": "bar111"}
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
merge_variables(step_variables, config_variables),
|
merge_variables(step_variables, config_variables),
|
||||||
{"base_url": HTTP_BIN_URL, "foo1": "bar1"},
|
{"base_url": "https://httpbin.org", "foo1": "bar1"},
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_cartesian_product_one(self):
|
def test_cartesian_product_one(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user