From 811bc7f95b8e253cf5bd64447bb2c3a37fe661aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= <57442769+gjedlicska@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:36:03 +0100 Subject: [PATCH] fix: update local testing setup (#13) --- tests/test_function.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_function.py b/tests/test_function.py index 574f1b4..b6d8559 100644 --- a/tests/test_function.py +++ b/tests/test_function.py @@ -3,9 +3,12 @@ import os import secrets import string +from specklepy.logging.exceptions import SpeckleException + import pytest from gql import gql from speckle_automate import ( + AutomationContext, AutomationRunData, AutomationStatus, run_function, @@ -115,6 +118,8 @@ def automation_run_data( test_object, [ServerTransport(project_id, test_client)] ) version_id = test_client.commit.create(project_id, root_obj_id) + if isinstance(version_id, SpeckleException): + raise version_id automation_name = crypto_random_string(10) automation_id = crypto_random_string(10) @@ -142,17 +147,22 @@ def automation_run_data( automation_revision_id=automation_revision_id, automation_run_id=automation_run_id, function_id=function_id, - function_revision=function_revision, + function_name=crypto_random_string(10), + function_logo=None, ) def test_function_run(automation_run_data: AutomationRunData, speckle_token: str): """Run an integration test for the automate function.""" + automation_context = AutomationContext.initialize( + automation_run_data, speckle_token + ) automate_sdk = run_function( + automation_context, automate_function, - automation_run_data, - speckle_token, - FunctionInputs(forbidden_speckle_type="Base"), + FunctionInputs( + forbidden_speckle_type="Base", whisper_message="testing automatically" + ), ) assert automate_sdk.run_status == AutomationStatus.FAILED