-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Felix Berlakovich
committed
Jan 2, 2025
1 parent
33b7529
commit 7ac36ac
Showing
3 changed files
with
24 additions
and
28 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import pydantic | ||
import pytest | ||
|
||
from kptncook.config import Settings | ||
from tests.conftest import temp_env | ||
from tests.conftest import MockSettings | ||
|
||
|
||
def test_config_accepts_mealie_username_password(): | ||
with temp_env(MEALIE_USERNAME="test", MEALIE_PASSWORD="test", KPTNCOOK_API_KEY="test"): | ||
settings = Settings() | ||
MockSettings( | ||
mealie_username="test", mealie_password="password", kptncook_api_key="test" | ||
) | ||
|
||
|
||
def test_config_accepts_mealie_token(): | ||
with temp_env(MEALIE_API_TOKEN="test", KPTNCOOK_API_KEY="test"): | ||
settings = Settings() | ||
MockSettings(mealie_api_token="test", kptncook_api_key="test") | ||
|
||
|
||
def test_config_rejects_empty_mealie_auth(): | ||
with pytest.raises(pydantic.ValidationError) as exception_info: | ||
with temp_env(KPTNCOOK_API_KEY="test"): | ||
settings = Settings() | ||
MockSettings(kptncook_api_key="test") | ||
|
||
assert "mealie" in str(exception_info.value) | ||
assert "must specify either" in str(exception_info.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters