Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2270 from pypeclub/feature/OP-2019_Create-test-pu…
Browse files Browse the repository at this point in the history
…blish-class-for-AE

Create test publish class for After Effects
  • Loading branch information
kalisp authored Dec 14, 2021
2 parents ad51cd8 + b57a09b commit ca7a92b
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 16 deletions.
2 changes: 1 addition & 1 deletion repos/avalon-core
101 changes: 101 additions & 0 deletions tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import pytest
import os
import shutil

from tests.lib.testing_classes import PublishTest


class TestPublishInAfterEffects(PublishTest):
"""Basic test case for publishing in AfterEffects
Uses generic TestCase to prepare fixtures for test data, testing DBs,
env vars.
Opens AfterEffects, run publish on prepared workile.
Test zip file sets 3 required env vars:
- HEADLESS_PUBLISH - this triggers publish immediately app is open
- IS_TEST - this differentiate between regular webpublish
- PYBLISH_TARGETS
Then checks content of DB (if subset, version, representations were
created.
Checks tmp folder if all expected files were published.
"""
PERSIST = True

TEST_FILES = [
("1c8261CmHwyMgS-g7S4xL5epAp0jCBmhf",
"test_aftereffects_publish.zip",
"")
]

APP = "aftereffects"
APP_VARIANT = "2022"

APP_NAME = "{}/{}".format(APP, APP_VARIANT)

TIMEOUT = 120 # publish timeout

@pytest.fixture(scope="module")
def last_workfile_path(self, download_test_data):
"""Get last_workfile_path from source data.
Maya expects workfile in proper folder, so copy is done first.
"""
src_path = os.path.join(download_test_data,
"input",
"workfile",
"test_project_test_asset_TestTask_v001.aep")
dest_folder = os.path.join(download_test_data,
self.PROJECT,
self.ASSET,
"work",
self.TASK)
os.makedirs(dest_folder)
dest_path = os.path.join(dest_folder,
"test_project_test_asset_TestTask_v001.aep")
shutil.copy(src_path, dest_path)

yield dest_path

@pytest.fixture(scope="module")
def startup_scripts(self, monkeypatch_session, download_test_data):
"""Points AfterEffects to userSetup file from input data"""
pass

def test_db_asserts(self, dbcon, publish_finished):
"""Host and input data dependent expected results in DB."""
print("test_db_asserts")
assert 3 == dbcon.count_documents({"type": "version"}), \
"Not expected no of versions"

assert 0 == dbcon.count_documents({"type": "version",
"name": {"$ne": 1}}), \
"Only versions with 1 expected"

assert 1 == dbcon.count_documents({"type": "subset",
"name": "imageMainBackgroundcopy"
}), \
"modelMain subset must be present"

assert 1 == dbcon.count_documents({"type": "subset",
"name": "workfileTesttask"}), \
"workfileTesttask subset must be present"

assert 1 == dbcon.count_documents({"type": "subset",
"name": "reviewTesttask"}), \
"reviewTesttask subset must be present"

assert 6 == dbcon.count_documents({"type": "representation"}), \
"Not expected no of representations"

assert 1 == dbcon.count_documents({"type": "representation",
"context.subset": "imageMainBackgroundcopy", #noqa E501
"context.ext": "png"}), \
"Not expected no of representations with ext 'png'"


if __name__ == "__main__":
test_case = TestPublishInAfterEffects()
29 changes: 14 additions & 15 deletions tests/integration/hosts/photoshop/test_publish_in_photoshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ class TestPublishInPhotoshop(PhotoshopTestClass):
Uses generic TestCase to prepare fixtures for test data, testing DBs,
env vars.
Always pulls and uses test data from GDrive!
Opens Photoshop, run publish on prepared workile.
Opens Photoshop, runs publish on prepared workile.
Test zip file sets 3 required env vars:
- HEADLESS_PUBLISH - this triggers publish immediately app is open
- IS_TEST - this differentiate between regular webpublish
- PYBLISH_TARGETS
Then checks content of DB (if subset, version, representations were
created.
Expand All @@ -35,33 +38,29 @@ class TestPublishInPhotoshop(PhotoshopTestClass):
def test_db_asserts(self, dbcon, publish_finished):
"""Host and input data dependent expected results in DB."""
print("test_db_asserts")
assert 5 == dbcon.count_documents({"type": "version"}), \
assert 3 == dbcon.count_documents({"type": "version"}), \
"Not expected no of versions"

assert 0 == dbcon.count_documents({"type": "version",
"name": {"$ne": 1}}), \
"Only versions with 1 expected"

assert 1 == dbcon.count_documents({"type": "subset",
"name": "modelMain"}), \
"name": "imageMainBackgroundcopy"}
), \
"modelMain subset must be present"

assert 1 == dbcon.count_documents({"type": "subset",
"name": "workfileTest_task"}), \
"name": "workfileTesttask"}), \
"workfileTest_task subset must be present"

assert 11 == dbcon.count_documents({"type": "representation"}), \
assert 6 == dbcon.count_documents({"type": "representation"}), \
"Not expected no of representations"

assert 2 == dbcon.count_documents({"type": "representation",
"context.subset": "modelMain",
"context.ext": "abc"}), \
"Not expected no of representations with ext 'abc'"

assert 2 == dbcon.count_documents({"type": "representation",
"context.subset": "modelMain",
"context.ext": "ma"}), \
"Not expected no of representations with ext 'abc'"
assert 1 == dbcon.count_documents({"type": "representation",
"context.subset": "imageMainBackgroundcopy", # noqa: E501
"context.ext": "png"}), \
"Not expected no of representations with ext 'png'"


if __name__ == "__main__":
Expand Down

0 comments on commit ca7a92b

Please sign in to comment.