Running pytest on automate function

Hey everyone!

I would like to run the integration tests on a functioned cloned from the python automate template. I created the .env based on the example and i also created a function_inputs.json on the root of the project.

I replaced my token, project id, model_id, and automation_id but I am not sure how to get the automation_run_id and function_run_id

With the current values I have I get this error:

self = <gql.client.SyncClientSession object at 0x7f4aaa32a540>, document = DocumentNode at 0:673
variable_values = {'automationId': '3f6392320e', 'projectId': '24fa0ed1c3'}, operation_name = None, serialize_variables = None, parse_result = None
get_execution_result = False, kwargs = {}
result = ExecutionResult(data=None, errors=[{'message': 'Automation not found', 'locations': [{'line': 4, 'column': 7}], 'path'...ATION_ERROR', 'exception': {'name': 'T
riggerAutomationError', 'message': 'Automation not found'}, 'statusCode': 500}}])

  • This is the automate function: Log in - Speckle
    I assume that 3f6392320e is the automationId right?

Thank you for your help :slight_smile:

3f6392320e is the functionId. You’ll need to click the ‘Use in an Automation’ button to create an Automation based on the function.

The automation will have a url like https://latest.speckle.systems/projects/5bc657bd7b/automations/6a0d398e73, where 6a0d398e73 is the automationId.

The automation_run_id and function_run_id are generated when the automation is run. If you are testing locally, these can probably be random values.

Hope this helps,

Iain

1 Like

The updated Testing section for our proto-docs Function Creation page shows the process of creating a sandbox test automation. This will give a token with all the scopes you need to test locally and as a manual trigger on test data.