Add mockapi source files and tests
This commit is contained in:
@@ -27,12 +27,7 @@ class TestConfig:
|
||||
|
||||
def test_load_from_dict(self):
|
||||
"""Test creating config with dict values."""
|
||||
config = Config(
|
||||
port=3000,
|
||||
host="127.0.0.1",
|
||||
delay=100,
|
||||
seed=123,
|
||||
)
|
||||
config = Config(port=3000, host="127.0.0.1", delay=100, seed=123)
|
||||
assert config.port == 3000
|
||||
assert config.host == "127.0.0.1"
|
||||
assert config.delay == 100
|
||||
@@ -73,9 +68,7 @@ class TestConfig:
|
||||
"seed": 456,
|
||||
}
|
||||
|
||||
with tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".yaml", delete=False
|
||||
) as f:
|
||||
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as f:
|
||||
yaml.dump(config_data, f)
|
||||
temp_path = f.name
|
||||
|
||||
@@ -93,9 +86,7 @@ class TestConfig:
|
||||
"""Test that environment variables override file config."""
|
||||
config_data = {"port": 7000, "host": "0.0.0.0"}
|
||||
|
||||
with tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".yaml", delete=False
|
||||
) as f:
|
||||
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as f:
|
||||
yaml.dump(config_data, f)
|
||||
temp_path = f.name
|
||||
|
||||
@@ -111,4 +102,4 @@ class TestConfig:
|
||||
def test_load_config_default_path(self):
|
||||
"""Test load_config with no arguments."""
|
||||
config = load_config()
|
||||
assert isinstance(config, Config)
|
||||
assert isinstance(config, Config)
|
||||
|
||||
Reference in New Issue
Block a user