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

Sync: Test edits and concepts #62

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
81 changes: 73 additions & 8 deletions tests/tests/mock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@
"data": None,
"description": "",
"entity_type_id": "1e1e03ea-3211-4a4c-a389-6bbedf9cd0e9",
"id": "ec6069cc-274a-4a27-a5de-a1f041db166c",
"id": "edit-id-1",
"is_casting_standby": False,
"name": "test_edit1",
"nb_entities_out": 0,
Expand All @@ -556,7 +556,7 @@
"data": None,
"description": "",
"entity_type_id": "1e1e03ea-3211-4a4c-a389-6bbedf9cd0e9",
"id": "4f1c9c68-f1ff-44b3-9c7a-9d8abd3d7419",
"id": "edit-id-2",
"is_casting_standby": False,
"name": "test_edit2",
"nb_entities_out": 0,
Expand All @@ -583,7 +583,7 @@
"description": None,
"entity_concept_links": [],
"entity_type_id": "e6fd7768-c032-4b6f-a5b4-2b0b892b8540",
"id": "62707498-bbd2-4fcf-a7be-4b061942086c",
"id": "concept-id-1",
"is_casting_standby": False,
"name": "temp1.png-5f893bd8-69eb-49d7-9093-fb4cc8327894",
"nb_entities_out": 0,
Expand All @@ -601,26 +601,26 @@
{
"canceled": False,
"code": None,
"created_at": "2024-02-19T13:16:00",
"created_by": "7910f71b-245b-4168-9c92-8bf38d0e403d",
"data": None,
"description": None,
"entity_concept_links": [],
"entity_type_id": "e6fd7768-c032-4b6f-a5b4-2b0b892b8540",
"id": "3be7f393-3696-4167-b10a-1efc584b0318",
"id": "concept-id-2",
"is_casting_standby": False,
"name": "temp2.jpg-a219866e-b637-4717-8490-b208a76a0d75",
"nb_entities_out": 0,
"nb_frames": None,
"parent_id": None,
"preview_file_id": "aa56ffb5-2875-420a-879e-4d23f2b40e28",
"project_id": "67c8ad65-0350-4b38-93be-5d0a4653f465",
"project_id": "project-id-1",
"ready_for": None,
"shotgun_id": None,
"source_id": None,
"status": "running",
"type": "Concept",
"updated_at": "2024-02-19T13:16:01",
"created_at": "2024-01-01T00:00:00",
"updated_at": "2024-01-01T00:00:00",
},
{
"canceled": False,
Expand All @@ -631,7 +631,7 @@
"description": None,
"entity_concept_links": [],
"entity_type_id": "e6fd7768-c032-4b6f-a5b4-2b0b892b8540",
"id": "60e2e35f-4cf3-4e4a-b0ab-5e11424ebb17",
"id": "concept-id-3",
"is_casting_standby": False,
"name": "temp3.jpg-d4e7d9af-5ccb-4192-b350-66b1049ee8f2",
"nb_entities_out": 0,
Expand All @@ -647,3 +647,68 @@
"updated_at": "2024-02-19T13:16:09",
},
]

all_concept_tasks = [
{
"assignees": [],
"name": "main",
"description": None,
"priority": 0,
"duration": 0.0,
"estimation": 0.0,
"completion_rate": 0,
"retake_count": 0,
"sort_order": 0,
"start_date": None,
"due_date": None,
"real_start_date": None,
"end_date": None,
"last_comment_date": "2024-02-12T17:48:54",
"nb_assets_ready": 0,
"data": None,
"shotgun_id": None,
"project_id": "3bbf7eb9-32ad-48a3-ba7b-c26606909c37",
"task_type_id": "task-type-id-3",
"task_type_name": "Concept",
"task_status_id": "status-id-1",
"task_status_name": "Approved",
"entity_id": "concept-id-1",
"assigner_id": "cc27d066-07cb-45c8-8a1c-0ca84eba48b2",
"id": "concept-task-id-1",
"created_at": "2024-02-12T17:48:54",
"updated_at": "2024-02-12T17:48:54",
"type": "Task",
"persons": [],
},
{
"assignees": [],
"name": "main",
"description": None,
"priority": 0,
"duration": 0.0,
"estimation": 0.0,
"completion_rate": 0,
"retake_count": 0,
"sort_order": 0,
"start_date": None,
"due_date": None,
"real_start_date": None,
"end_date": None,
"last_comment_date": "2024-02-12T17:48:54",
"nb_assets_ready": 0,
"data": None,
"shotgun_id": None,
"project_id": "project-id-1",
"task_type_id": "task-type-id-3",
"task_type_name": "Concept",
"task_status_id": "status-id-1",
"task_status_name": "Approved",
"entity_id": "concept-id-2",
"assigner_id": "user-id-1",
"id": "concept-task-id-2",
"created_at": "2024-02-12T17:48:54",
"updated_at": "2024-02-12T17:48:54",
"type": "Task",
"persons": [],
},
]
51 changes: 51 additions & 0 deletions tests/tests/test_push_concept.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""tests for endpoint 'api/addons/kitsu/{version}/push'
with entities of kitsu type: Concept

$ poetry run pytest tests/test_push_concept.py
"""

from pprint import pprint

import pytest

from . import mock_data
from .fixtures import (
PROJECT_NAME,
api,
kitsu_url,
)


def test_push_concepts(api, kitsu_url):
entities = mock_data.all_concepts_for_project

res = api.post(
f"{kitsu_url}/push",
project_name=PROJECT_NAME,
entities=entities,
)
assert res.status_code == 200
assert "folders" in res.data
assert list(res.data["folders"].keys()) == [
"concept-id-1",
"concept-id-2",
"concept-id-3",
]


def test_push_concept_tasks(api, kitsu_url):
entities = mock_data.all_concept_tasks

res = api.post(
f"{kitsu_url}/push",
project_name=PROJECT_NAME,
entities=entities,
)
assert res.status_code == 200
pprint(res.data)

assert "tasks" in res.data
assert list(res.data["tasks"].keys()) == [
"concept-task-id-1",
"concept-task-id-2",
]
52 changes: 52 additions & 0 deletions tests/tests/test_push_edit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""tests for endpoint 'api/addons/kitsu/{version}/push'
with entities of kitsu type: Edit

$ poetry run pytest tests/test_push_edit.py
"""

from pprint import pprint

import pytest

from . import mock_data
from .fixtures import (
PROJECT_NAME,
api,
kitsu_url,
)


def test_push_edits(api, kitsu_url):
entities = mock_data.all_edits_for_project

res = api.post(
f"{kitsu_url}/push",
project_name=PROJECT_NAME,
entities=entities,
)
assert res.status_code == 200
assert "folders" in res.data
assert list(res.data["folders"].keys()) == ["edit-id-1", "edit-id-2"]


def test_edit_name_validation_bugfix(api, kitsu_url):
edit = {
"id": "edit-id-3",
"name": "",
"code": None,
"description": "",
"shotgun_id": None,
"canceled": False,
"nb_frames": None,
"nb_entities_out": 0,
"is_casting_standby": False,
"status": "running",
"project_id": "74f89547-91e2-4b91-9fd5-960cc33b30a5",
"entity_type_id": "65d66965-09c4-45df-857a-112e509db6ef",
"parent_id": "f998c1ba-4f71-4d7e-b3f4-a1c868709612",
"source_id": None,
"preview_file_id": None,
"data": None,
"ready_for": None,
"type": "Edit",
}