Skip to content

Commit

Permalink
fix: update local testing setup (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedlicska committed Feb 9, 2024
1 parent 5c0ac4e commit 811bc7f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 811bc7f

Please sign in to comment.