Skip to content

Commit

Permalink
Allow no calendars
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Mar 18, 2024
1 parent 5c7fc6b commit 3bc3845
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion calmerge/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def expand_url_vars(cls, urls: list[str]) -> list[str]:


class Config(BaseModel):
calendars: list[CalendarConfig] = Field(alias="calendar")
calendars: list[CalendarConfig] = Field(alias="calendar", default_factory=list)

@classmethod
def from_file(cls, path: Path):
Expand Down
6 changes: 5 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pydantic import ValidationError
from pydantic_core import Url

from calmerge.config import AuthConfig, CalendarConfig
from calmerge.config import AuthConfig, CalendarConfig, Config


def test_non_unique_urls():
Expand Down Expand Up @@ -34,3 +34,7 @@ def test_expand_unknown_var():

assert auth_config.username == "$FOO"
assert auth_config.password == "${FOO}BAR"


def test_empty_config():
Config()

0 comments on commit 3bc3845

Please sign in to comment.