def test_create_task_no_asset_shot(bootstrapped_project, mock_print_result,
                                       cwd_finding_dory):
        # try to create a task for a context with no entity
        ktrack_command.create("task", "some_step", task_step="prep")

        # make sure error was printed
        mock_print_result.assert_called_with("No entity provided for task")
    def test_create_task_no_step(bootstrapped_project, mock_print_result,
                                 cwd_finding_dory):
        # create task without step for asset Hank
        ktrack_command.create("task", "some_step")

        # make sure 'no task step' was printed to console
        mock_print_result.assert_called_with("no task step")
    def test_create_shot(bootstrapped_project, cwd_finding_dory):
        shot_code = "shot050"
        # ACT and create the asset
        ktrack_command.create("shot", shot_code)

        # now check everything is correct

        # check asset was created in database
        assert project_has_shot_with_code(bootstrapped_project["id"],
                                          shot_code)

        # check asset folder exists on disk
        shots_folder = os.path.join(FINDING_DORY_PATH, "Shots", shot_code)
        assert os.path.exists(shots_folder)

        # make sure we can get context from this path correctly
        context = path_cache_manager.context_from_path(shots_folder)
        assert context

        # make sure context project is correct
        assert context.project["id"] == bootstrapped_project["id"]
        assert context.entity

        # make sure context entity is correct
        kt = ktrack_api.get_ktrack()
        assert kt.find_one("shot", context.entity["id"])["code"] == "shot050"
    def test_create_asset(bootstrapped_project, cwd_finding_dory):
        asset_name = "Nemo"
        # ACT and create the asset
        ktrack_command.create("asset", asset_name, asset_type="character")

        # now check everything is correct

        # check asset was created in database
        assert project_has_asset_with_code(bootstrapped_project["id"],
                                           asset_name)

        # check asset folder exists on disk
        asset_folder = os.path.join(FINDING_DORY_PATH, "Assets", "character",
                                    "Nemo")
        assert os.path.exists(asset_folder)

        # make sure we can get context from this path correctly
        context = path_cache_manager.context_from_path(asset_folder)
        assert context

        # make sure context project is correct
        assert context.project["id"] == bootstrapped_project["id"]
        assert context.entity

        # make sure context entity is correct
        kt = ktrack_api.get_ktrack()
        assert kt.find_one("asset", context.entity["id"])["code"] == "Nemo"
    def test_create_task_shot(bootstrapped_project, cwd_shot010):
        # create a prep task for shot shot010
        task_name = "preping_the_test"
        ktrack_command.create("task", task_name, task_step="prep")

        # make sure a task with the name exists for the project
        assert project_has_task_with_name(bootstrapped_project["id"],
                                          task_name)
    def test_create_task_asset(bootstrapped_project, mock_print_result,
                               cwd_hank):
        # create a texturing task for asset Hank
        task_name = "texturing_hank"
        ktrack_command.create("task", task_name, task_step="prep")

        # make sure a task with the name exists for the project
        assert project_has_task_with_name(bootstrapped_project["id"],
                                          task_name)
    def test_create_asset_no_asset_type(bootstrapped_project,
                                        mock_print_result, cwd_finding_dory):
        ktrack_command.create("asset", "Nemo")

        mock_print_result.assert_called_with("no asset type")
    def test_create_no_context(mock_print_result, cwd_no_context):
        # test what happens if we run create without being in a directory for a context
        ktrack_command.create("shot", "shot010")

        mock_print_result.assert_called_with("No context provided for path")