Some renaming
This commit is contained in:
@@ -10,7 +10,7 @@ from src.config import Config
|
||||
|
||||
|
||||
class HomeAssistant:
|
||||
class PublishMessage(BaseModel):
|
||||
class Message(BaseModel):
|
||||
target: str
|
||||
action: str
|
||||
content: str
|
||||
@@ -18,13 +18,13 @@ class HomeAssistant:
|
||||
def __init__(self, ticktick: TickTick) -> None:
|
||||
self._ticktick = ticktick
|
||||
|
||||
def process_publish_message(self, message: PublishMessage) -> dict[str, str]:
|
||||
def process_message(self, message: Message) -> dict[str, str]:
|
||||
if message.target == "ticktick":
|
||||
return self._process_ticktick_message(message=message)
|
||||
|
||||
return {"Status": "Unknown target"}
|
||||
|
||||
def _process_ticktick_message(self, message: PublishMessage) -> dict[str, str]:
|
||||
def _process_ticktick_message(self, message: Message) -> dict[str, str]:
|
||||
if message.action == "create_shopping_list":
|
||||
return self._create_shopping_list(content=message.content)
|
||||
if message.action == "create_action_task":
|
||||
|
||||
0
src/cloud_util/tests/__init__.py
Normal file
0
src/cloud_util/tests/__init__.py
Normal file
7
src/cloud_util/tests/test_ticktick.py
Normal file
7
src/cloud_util/tests/test_ticktick.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from cloud_util.ticktick import TickTick
|
||||
|
||||
|
||||
def test_ticktick_begin_auth() -> None:
|
||||
auth_url = TickTick.begin_auth()
|
||||
Reference in New Issue
Block a user