Skip to content

Commit 449ee29

Browse files
authored
Merge pull request #2 from jcastro/main
Version Updated
2 parents 04e9674 + 8a655e4 commit 449ee29

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG PYTHON_BASE=python:3.12-slim@sha256:804ddf3251a60bbf9c92e73b7566c40428d54d0e79d3428194edf40da6521286
2-
ARG VERSION=0.1.10
2+
ARG VERSION=0.1.11
33
ARG BUILD_DATE=unknown
44
ARG VCS_REF=unknown
55
ARG SOURCE_URL=https://github.com/jcastro/stopliga
@@ -31,7 +31,7 @@ RUN python -m pytest tests/ -v
3131

3232
FROM ${PYTHON_BASE} AS runtime
3333

34-
ARG VERSION=0.1.10
34+
ARG VERSION=0.1.11
3535
ARG BUILD_DATE=unknown
3636
ARG VCS_REF=unknown
3737
ARG SOURCE_URL=https://github.com/jcastro/stopliga

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "stopliga"
7-
version = "0.1.10"
7+
version = "0.1.11"
88
description = "Synchronize a UniFi policy-based route with a public GitHub IP feed."
99
readme = "README.md"
1010
requires-python = ">=3.11"

src/stopliga/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@ def validate_config(config: Config, *, validate_connection: bool) -> None:
536536
raise ConfigError(
537537
"Telegram notifications require STOPLIGA_TELEGRAM_BOT_TOKEN and either STOPLIGA_TELEGRAM_CHAT_ID or STOPLIGA_TELEGRAM_GROUP_ID"
538538
)
539-
if config.telegram_topic_id is not None and not telegram_target:
540-
raise ConfigError("STOPLIGA_TELEGRAM_TOPIC_ID requires STOPLIGA_TELEGRAM_GROUP_ID or STOPLIGA_TELEGRAM_CHAT_ID")
539+
if config.telegram_topic_id is not None and not config.telegram_group_id:
540+
raise ConfigError("STOPLIGA_TELEGRAM_TOPIC_ID requires STOPLIGA_TELEGRAM_GROUP_ID")
541541
if config.telegram_topic_id is not None and config.telegram_topic_id <= 0:
542542
raise ConfigError("STOPLIGA_TELEGRAM_TOPIC_ID must be > 0")
543543
if validate_connection:

tests/test_config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,21 @@ def test_telegram_topic_requires_chat_target(self) -> None:
172172
},
173173
)
174174

175+
def test_telegram_topic_requires_group_target(self) -> None:
176+
parser = build_parser()
177+
args = parser.parse_args([])
178+
with self.assertRaises(ConfigError):
179+
load_config(
180+
args,
181+
{
182+
"UNIFI_HOST": "10.0.0.2",
183+
"UNIFI_API_KEY": "test-api-key",
184+
"STOPLIGA_TELEGRAM_BOT_TOKEN": "123456:test",
185+
"STOPLIGA_TELEGRAM_CHAT_ID": "1234",
186+
"STOPLIGA_TELEGRAM_TOPIC_ID": "42",
187+
},
188+
)
189+
175190
def test_telegram_group_and_topic_load_successfully(self) -> None:
176191
parser = build_parser()
177192
args = parser.parse_args([])

0 commit comments

Comments
 (0)