mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
21 lines
655 B
Python
21 lines
655 B
Python
import pytest
|
|
|
|
from infrastructure.magic_plan.config import MagicPlanConfig
|
|
|
|
_ENV = {"MAGICPLAN_CUSTOMER_ID": "cust-123", "MAGICPLAN_API_KEY": "key-abc"}
|
|
|
|
|
|
def test_from_env_constructs_config() -> None:
|
|
config = MagicPlanConfig.from_env(_ENV)
|
|
assert config.customer_id == "cust-123"
|
|
assert config.api_key == "key-abc"
|
|
|
|
|
|
def test_from_env_raises_on_missing_customer_id() -> None:
|
|
with pytest.raises(KeyError):
|
|
MagicPlanConfig.from_env({"MAGICPLAN_API_KEY": "key-abc"})
|
|
|
|
|
|
def test_from_env_raises_on_missing_api_key() -> None:
|
|
with pytest.raises(KeyError):
|
|
MagicPlanConfig.from_env({"MAGICPLAN_CUSTOMER_ID": "cust-123"})
|