Skip to content

Commit 052d469

Browse files
BoggerBytelefcha
authored andcommitted
refactor: used pydantic for object mapping
1 parent 988a2b7 commit 052d469

File tree

5 files changed

+211
-303
lines changed

5 files changed

+211
-303
lines changed

poetry.lock

Lines changed: 144 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ include = [
2020
[tool.poetry.dependencies]
2121
python = "^3.9"
2222
requests = "^2.32.3"
23+
pydantic = "^2.10"
2324

2425
[tool.poetry.group.dev.dependencies]
2526
pytest = "^7.2.0"

tests/data/quick_add_responses.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Any
44

5+
from tests.data.test_defaults import DEFAULT_DURATION_RESPONSE
6+
57
QUICK_ADD_RESPONSE_MINIMAL: dict[str, Any] = {
68
"added_by_uid": "21180723",
79
"assigned_by_uid": None,
@@ -13,6 +15,7 @@
1315
"added_at": "2021-02-05T11:02:56.00000Z",
1416
"date_completed": None,
1517
"due": None,
18+
"duration": None,
1619
"id": "4554989047",
1720
"in_history": 0,
1821
"is_deleted": 0,
@@ -62,6 +65,10 @@
6265
"string": "Feb 6 11:00 AM",
6366
"timezone": "Europe/London",
6467
},
68+
"duration": {
69+
"amount": 60,
70+
"unit": "minute",
71+
},
6572
"id": "4554993687",
6673
"in_history": 0,
6774
"is_deleted": 0,

tests/data/test_defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"comment_count": 0,
3939
"creator_id": "0",
4040
"created_at": "2019-01-02T21:00:30.00000Z",
41-
"url": "https://todoist.com/showTask?id=2995104339",
41+
"url": "https://todoist.com/showTask?id=1234",
4242
"due": DEFAULT_DUE_RESPONSE,
4343
"duration": DEFAULT_DURATION_RESPONSE,
4444
}
@@ -97,7 +97,7 @@
9797
}
9898

9999
DEFAULT_SECTION_RESPONSE_2 = dict(DEFAULT_SECTION_RESPONSE)
100-
DEFAULT_SECTION_RESPONSE_2["id"] = 5678
100+
DEFAULT_SECTION_RESPONSE_2["id"] = "5678"
101101

102102
DEFAULT_SECTIONS_RESPONSE = [
103103
DEFAULT_SECTION_RESPONSE,

0 commit comments

Comments
 (0)