Skip to content
Snippets Groups Projects
Verified Commit 58d7c2d2 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

add unit test for TWAMP deployment workflow

parent 78f91b3f
No related branches found
No related tags found
1 merge request!129Add workflow for TWAMP deployment
from unittest.mock import patch
import pytest
from gso.products import Iptrunk
from test.workflows import (
assert_complete,
assert_pp_interaction_success,
extract_state,
run_workflow,
)
@pytest.mark.workflow()
@patch("gso.workflows.iptrunk.deploy_twamp.execute_playbook")
def test_iptrunk_deploy_twamp_success(
mock_execute_playbook,
iptrunk_subscription_factory,
faker,
):
# Set up mock return values
product_id = iptrunk_subscription_factory()
# Run workflow
initial_input_data = [{"subscription_id": product_id}, {}]
result, process_stat, step_log = run_workflow("deploy_twamp", initial_input_data)
for _ in range(2):
result, step_log = assert_pp_interaction_success(result, process_stat, step_log)
assert_complete(result)
state = extract_state(result)
subscription_id = state["subscription_id"]
subscription = Iptrunk.from_subscription(subscription_id)
assert subscription.status == "active"
assert mock_execute_playbook.call_count == 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment