fix: update local testing setup (#13)
This commit is contained in:
+14
-4
@@ -3,9 +3,12 @@ import os
|
|||||||
import secrets
|
import secrets
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
from specklepy.logging.exceptions import SpeckleException
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from gql import gql
|
from gql import gql
|
||||||
from speckle_automate import (
|
from speckle_automate import (
|
||||||
|
AutomationContext,
|
||||||
AutomationRunData,
|
AutomationRunData,
|
||||||
AutomationStatus,
|
AutomationStatus,
|
||||||
run_function,
|
run_function,
|
||||||
@@ -115,6 +118,8 @@ def automation_run_data(
|
|||||||
test_object, [ServerTransport(project_id, test_client)]
|
test_object, [ServerTransport(project_id, test_client)]
|
||||||
)
|
)
|
||||||
version_id = test_client.commit.create(project_id, root_obj_id)
|
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_name = crypto_random_string(10)
|
||||||
automation_id = 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_revision_id=automation_revision_id,
|
||||||
automation_run_id=automation_run_id,
|
automation_run_id=automation_run_id,
|
||||||
function_id=function_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):
|
def test_function_run(automation_run_data: AutomationRunData, speckle_token: str):
|
||||||
"""Run an integration test for the automate function."""
|
"""Run an integration test for the automate function."""
|
||||||
|
automation_context = AutomationContext.initialize(
|
||||||
|
automation_run_data, speckle_token
|
||||||
|
)
|
||||||
automate_sdk = run_function(
|
automate_sdk = run_function(
|
||||||
|
automation_context,
|
||||||
automate_function,
|
automate_function,
|
||||||
automation_run_data,
|
FunctionInputs(
|
||||||
speckle_token,
|
forbidden_speckle_type="Base", whisper_message="testing automatically"
|
||||||
FunctionInputs(forbidden_speckle_type="Base"),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert automate_sdk.run_status == AutomationStatus.FAILED
|
assert automate_sdk.run_status == AutomationStatus.FAILED
|
||||||
|
|||||||
Reference in New Issue
Block a user