E2B/packages/python-sdk/tests/test_connection_config.py
Joseph Lombrozo d2e22e3748
Some general pytest cleanup (#1021)
- Individual tests must complete in less than 5 minutes
- Add a `make test` option that runs tests
- Upgrade poetry to 2.1.1 (the lock file was generated by this version,
so this just matches what we already expect)
2025-11-13 17:58:30 -08:00

28 lines
783 B
Python

from e2b import ConnectionConfig
def test_api_url_defaults_correctly(monkeypatch):
monkeypatch.setenv("E2B_DOMAIN", "")
config = ConnectionConfig()
assert config.api_url == "https://api.e2b.app"
def test_api_url_in_args():
config = ConnectionConfig(api_url="http://localhost:8080")
assert config.api_url == "http://localhost:8080"
def test_api_url_in_env_var(monkeypatch):
monkeypatch.setenv("E2B_API_URL", "http://localhost:8080")
config = ConnectionConfig()
assert config.api_url == "http://localhost:8080"
def test_api_url_has_correct_priority(monkeypatch):
monkeypatch.setenv("E2B_API_URL", "http://localhost:1111")
config = ConnectionConfig(api_url="http://localhost:8080")
assert config.api_url == "http://localhost:8080"