Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kitsu Task type and status sync + tests #81

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions server/kitsu/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ async def ensure_task_type(
project.task_types.append(
{
"name": task_type_name,
"short_name": task_type_name[:4],
"shortName": task_type_name[:4],
"icon": "task_alt",
}
)
await project.save()
Expand All @@ -502,7 +503,8 @@ async def ensure_task_status(
project.statuses.append(
{
"name": task_status_name,
"short_name": task_status_name[:4],
"icon": "task_alt",
"shortName": task_status_name[:4],
}
)
await project.save()
Expand Down
8 changes: 5 additions & 3 deletions tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
name = "ayon-kitsu"
version = "1.2.4-dev.1"
description = ""
package-mode = false
authors = ["Martastain <[email protected]>", "Scott McDonnell <[email protected]", "Jacob Danell <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.8"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pytest = "^7.0.1"
gazu = "^0.9.17"
ayon-python-api = "^1.0.0"
requests = "^2.27.1"
nxtools = "^1.6"
codenamize = "^1.2.4-dev.1"
pytest-mock = "^3.12.0"
python-dotenv = "^1.0.1"
codenamize = "^1.2.3"
httpx = "^0.27.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry.core.masonry.api"
2 changes: 2 additions & 0 deletions tests/tests/test_push_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def test_push_tasks(api, kitsu_url, monkeypatch):
"clipOut": 1,
"clipIn": 1,
"pixelAspect": 1.0,
"priority": "normal",
}

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

# ---------------------------------------------
Expand Down
30 changes: 29 additions & 1 deletion tests/tests/test_push_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,19 @@ def test_update_project_statuses(api, kitsu_url, ensure_kitsu_server_setting):
res = api.put(f"/projects/{project_name}", **project_meta)

project = api.get_project(project_name)
assert project["statuses"] == [{"name": "Todo"}]
assert project["statuses"] == [
{
"name": "Todo",
"scope": [
"folder",
"task",
"product",
"version",
"representation",
"workfile",
],
}
]

res = api.post(
f"{kitsu_url}/push",
Expand All @@ -124,13 +136,29 @@ def test_update_project_statuses(api, kitsu_url, ensure_kitsu_server_setting):
"name": "Todo",
"shortName": "TODO",
"state": "in_progress",
"scope": [
"folder",
"product",
"version",
"representation",
"task",
"workfile",
],
},
{
"color": "#22D160",
"icon": "task_alt",
"name": "Approved",
"shortName": "App",
"state": "in_progress",
"scope": [
"folder",
"product",
"version",
"representation",
"task",
"workfile",
],
},
]
api.delete(f"/projects/{project_name}")
Expand Down