Skip to content

Commit 1ba1fd5

Browse files
authored
Merge pull request #81 from johhnry/task-type-short-name
Fix Kitsu Task type and status sync + tests
2 parents e421522 + 77cb7b6 commit 1ba1fd5

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

server/kitsu/push.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ async def ensure_task_type(
478478
project.task_types.append(
479479
{
480480
"name": task_type_name,
481-
"short_name": task_type_name[:4],
481+
"shortName": task_type_name[:4],
482+
"icon": "task_alt",
482483
}
483484
)
484485
await project.save()
@@ -502,7 +503,8 @@ async def ensure_task_status(
502503
project.statuses.append(
503504
{
504505
"name": task_status_name,
505-
"short_name": task_status_name[:4],
506+
"icon": "task_alt",
507+
"shortName": task_status_name[:4],
506508
}
507509
)
508510
await project.save()

tests/pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
name = "ayon-kitsu"
33
version = "1.2.4-dev.1"
44
description = ""
5+
package-mode = false
56
authors = ["Martastain <martas@imm.cz>", "Scott McDonnell <scott@jammedia.com", "Jacob Danell <jacob@emberlight.se>"]
67

78
[tool.poetry.dependencies]
89
python = "^3.8"
910

10-
[tool.poetry.dev-dependencies]
11+
[tool.poetry.group.dev.dependencies]
1112
pytest = "^7.0.1"
1213
gazu = "^0.9.17"
1314
ayon-python-api = "^1.0.0"
1415
requests = "^2.27.1"
1516
nxtools = "^1.6"
16-
codenamize = "^1.2.4-dev.1"
1717
pytest-mock = "^3.12.0"
1818
python-dotenv = "^1.0.1"
19+
codenamize = "^1.2.3"
20+
httpx = "^0.27.2"
1921

2022
[build-system]
2123
requires = ["poetry-core>=1.0.0"]
22-
build-backend = "poetry.core.masonry.api"
24+
build-backend = "poetry.core.masonry.api"

tests/tests/test_push_create.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def test_push_tasks(api, kitsu_url, monkeypatch):
292292
"clipOut": 1,
293293
"clipIn": 1,
294294
"pixelAspect": 1.0,
295+
"priority": "normal",
295296
}
296297

297298
res = api.get(f"/projects/{PROJECT_NAME}/tasks/{tasks['task-id-2']}")
@@ -314,6 +315,7 @@ def test_push_tasks(api, kitsu_url, monkeypatch):
314315
"clipOut": 1,
315316
"clipIn": 1,
316317
"pixelAspect": 1.0,
318+
"priority": "normal",
317319
}
318320

319321
# ---------------------------------------------

tests/tests/test_push_project.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,19 @@ def test_update_project_statuses(api, kitsu_url, ensure_kitsu_server_setting):
106106
res = api.put(f"/projects/{project_name}", **project_meta)
107107

108108
project = api.get_project(project_name)
109-
assert project["statuses"] == [{"name": "Todo"}]
109+
assert project["statuses"] == [
110+
{
111+
"name": "Todo",
112+
"scope": [
113+
"folder",
114+
"task",
115+
"product",
116+
"version",
117+
"representation",
118+
"workfile",
119+
],
120+
}
121+
]
110122

111123
res = api.post(
112124
f"{kitsu_url}/push",
@@ -124,13 +136,29 @@ def test_update_project_statuses(api, kitsu_url, ensure_kitsu_server_setting):
124136
"name": "Todo",
125137
"shortName": "TODO",
126138
"state": "in_progress",
139+
"scope": [
140+
"folder",
141+
"product",
142+
"version",
143+
"representation",
144+
"task",
145+
"workfile",
146+
],
127147
},
128148
{
129149
"color": "#22D160",
130150
"icon": "task_alt",
131151
"name": "Approved",
132152
"shortName": "App",
133153
"state": "in_progress",
154+
"scope": [
155+
"folder",
156+
"product",
157+
"version",
158+
"representation",
159+
"task",
160+
"workfile",
161+
],
134162
},
135163
]
136164
api.delete(f"/projects/{project_name}")

0 commit comments

Comments
 (0)