mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
⚗️ fix the test stub for get_transfers_from_representation
This commit is contained in:
parent
348c7345b5
commit
a312ac7ff2
2 changed files with 12 additions and 28 deletions
|
|
@ -826,7 +826,8 @@ class IntegrateTraits(pyblish.api.InstancePlugin):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# add template path and the data to resolve it
|
# add template path and the data to resolve it
|
||||||
|
if not representation.contains_trait(TemplatePath):
|
||||||
representation.add_trait(TemplatePath(
|
representation.add_trait(TemplatePath(
|
||||||
template=template_item.template,
|
template=template_item.template,
|
||||||
data=template_item.template_data
|
data=template_item.template_data
|
||||||
|
|
@ -908,7 +909,7 @@ class IntegrateTraits(pyblish.api.InstancePlugin):
|
||||||
template_item.template_object["path"]
|
template_item.template_object["path"]
|
||||||
)
|
)
|
||||||
template_item.template_data["ext"] = (
|
template_item.template_data["ext"] = (
|
||||||
representation.get_trait(FileLocation).file_path.suffix
|
representation.get_trait(FileLocation).file_path.suffix.rstrip(".")
|
||||||
)
|
)
|
||||||
template_item.template_data.pop("frame", None)
|
template_item.template_data.pop("frame", None)
|
||||||
with contextlib.suppress(MissingTraitError):
|
with contextlib.suppress(MissingTraitError):
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ def mock_context(
|
||||||
),
|
),
|
||||||
Sequence(
|
Sequence(
|
||||||
frame_padding=4,
|
frame_padding=4,
|
||||||
frame_regex=r"^img\.(?P<frame>\d{4})\.png$",
|
frame_regex=r"img\.(?P<index>(?P<padding>0*)\d{4})\.png$",
|
||||||
),
|
),
|
||||||
FileLocations(
|
FileLocations(
|
||||||
file_paths=file_locations,
|
file_paths=file_locations,
|
||||||
|
|
@ -269,7 +269,13 @@ def test_prepare_version(
|
||||||
|
|
||||||
def test_get_transfers_from_representation(
|
def test_get_transfers_from_representation(
|
||||||
mock_context: pyblish.api.Context) -> None:
|
mock_context: pyblish.api.Context) -> None:
|
||||||
"""Test get_transfers_from_representation."""
|
"""Test get_transfers_from_representation.
|
||||||
|
|
||||||
|
Todo: This test will benefit massively from a proper mocking of the
|
||||||
|
context. We need to parametrize the test with different
|
||||||
|
representations and test the output of the function.
|
||||||
|
|
||||||
|
"""
|
||||||
integrator = IntegrateTraits()
|
integrator = IntegrateTraits()
|
||||||
|
|
||||||
instance = mock_context[0]
|
instance = mock_context[0]
|
||||||
|
|
@ -278,27 +284,4 @@ def test_get_transfers_from_representation(
|
||||||
transfers = integrator.get_transfers_from_representations(
|
transfers = integrator.get_transfers_from_representations(
|
||||||
instance, representations)
|
instance, representations)
|
||||||
|
|
||||||
assert transfers == [
|
assert len(transfers) == 11
|
||||||
{
|
|
||||||
"file_path": Path("test"),
|
|
||||||
"file_size": 1234,
|
|
||||||
"traits": [
|
|
||||||
"Persistent",
|
|
||||||
"Image",
|
|
||||||
"MimeType"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file_path": Path("test"),
|
|
||||||
"file_size": 1234,
|
|
||||||
"traits": [
|
|
||||||
"Persistent",
|
|
||||||
"FrameRanged",
|
|
||||||
"Sequence",
|
|
||||||
"FileLocations",
|
|
||||||
"Image",
|
|
||||||
"PixelBased",
|
|
||||||
"MimeType"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue