diff --git a/server_addon/maya/client/ayon_maya/api/testing/lib.py b/server_addon/maya/client/ayon_maya/api/testing/lib.py index e03e7b7332..a249ee76c8 100644 --- a/server_addon/maya/client/ayon_maya/api/testing/lib.py +++ b/server_addon/maya/client/ayon_maya/api/testing/lib.py @@ -6,6 +6,8 @@ import pyblish.api import ayon_api from ayon_core.pipeline import ( get_current_project_name, + get_current_folder_path, + get_current_task_name, Anatomy, get_current_context, get_current_host_name, @@ -71,6 +73,16 @@ def recursive_validate(valid_action_names): """ context = pyblish.api.Context() context.data["create_context"] = CreateContext(registered_host()) + project_name = get_current_project_name() + folder_path = get_current_folder_path() + folder_entity = ayon_api.get_folder_by_path( + project_name, folder_path) + context.data["folderEntity"] = folder_entity + if folder_entity: + task_name = get_current_task_name + context.data["taskEntity"] = ayon_api.get_task_by_name( + project_name, folder_entity["id"], task_name + ) context = pyblish.util.collect(context) pyblish.util.validate(context) diff --git a/server_addon/maya/client/ayon_maya/api/testing/tests.py b/server_addon/maya/client/ayon_maya/api/testing/tests.py index e634c6d733..a99512cb29 100644 --- a/server_addon/maya/client/ayon_maya/api/testing/tests.py +++ b/server_addon/maya/client/ayon_maya/api/testing/tests.py @@ -71,6 +71,7 @@ def test_create(): hierarchy = {} if "instance_node" in instance.data: members = cmds.sets(instance.data["instance_node"], query=True) + print(members) hierarchy[instance.data["instance_node"]] = cmds.ls( members, type="dagNode" ) @@ -88,14 +89,13 @@ def test_create(): "creator_attributes": creator_attributes } ) - instances_to_remove.append(instance) context.remove_instances(instances_to_remove) for data in create_data: created_instance = context.create( - creator_identifier=creator_identifier, + creator_identifier=data["creator_identifier"], variant="Main", pre_create_data={"use_selection": True} ) @@ -105,7 +105,7 @@ def test_create(): cmds.sets(nodes, forceElement=set) if created_instance: - for key, value in data.creator_attributes: + for key, value in data["creator_attributes"].items(): created_instance.creator_attributes[key] = value context.save_changes()