OP-2019 - fixes for PS test class

This commit is contained in:
Petr Kalis 2021-12-03 11:42:22 +01:00
parent f9a1445a74
commit 477d177bd9

View file

@ -11,7 +11,12 @@ class TestPublishInPhotoshop(PublishTest):
Uses generic TestCase to prepare fixtures for test data, testing DBs,
env vars.
Opens Maya, run publish on prepared workile.
Opens Photoshop, 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.
@ -21,11 +26,11 @@ class TestPublishInPhotoshop(PublishTest):
PERSIST = True
TEST_FILES = [
("1Bciy2pCwMKl1UIpxuPnlX_LHMo_Xkq0K", "test_photoshop_publish.zip", "")
("1zD2v5cBgkyOm_xIgKz3WKn8aFB_j8qC-", "test_photoshop_publish.zip", "")
]
APP = "photoshop"
APP_VARIANT = "2020"
APP_VARIANT = "2021"
APP_NAME = "{}/{}".format(APP, APP_VARIANT)
@ -56,12 +61,12 @@ class TestPublishInPhotoshop(PublishTest):
@pytest.fixture(scope="module")
def startup_scripts(self, monkeypatch_session, download_test_data):
"""Points Maya to userSetup file from input data"""
os.environ["IS_HEADLESS"] = "true"
pass
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",
@ -69,25 +74,21 @@ class TestPublishInPhotoshop(PublishTest):
"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__":