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

add unit test for TWAMP deployment workflow

parent d1a44456
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !129. Comments created here will be created in the context of that merge request.
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.
Please register or to comment