mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
add unit test
This commit is contained in:
parent
c62b65a9d7
commit
dd79517f2d
1 changed files with 24 additions and 0 deletions
24
tests/litellm/test_init.py
Normal file
24
tests/litellm/test_init.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# tests/litellm/test_init.py
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
def test_api_key_from_env(monkeypatch):
|
||||
monkeypatch.setenv("LITELLM_API_KEY", "mocked_key")
|
||||
|
||||
if "litellm" in sys.modules:
|
||||
del sys.modules["litellm"]
|
||||
import litellm
|
||||
importlib.reload(litellm)
|
||||
|
||||
assert litellm.api_key == "mocked_key"
|
||||
|
||||
def test_api_base_from_env(monkeypatch):
|
||||
monkeypatch.setenv("LITELLM_API_BASE", "https://mocked-base.com")
|
||||
|
||||
if "litellm" in sys.modules:
|
||||
del sys.modules["litellm"]
|
||||
import litellm
|
||||
importlib.reload(litellm)
|
||||
|
||||
assert litellm.api_base == "https://mocked-base.com"
|
Loading…
Add table
Add a link
Reference in a new issue