Skip to content
Snippets Groups Projects

Add unit tests for imported products

Merged Karel van Klink requested to merge feature/add-tests-for-imported-products into develop
All threads resolved!
13 files
+ 355
24
Compare changes
  • Side-by-side
  • Inline
Files
13
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_blocks.iptrunk import IptrunkType, PhysicalPortCapacity
from gso.products.product_types.iptrunk import ImportedIptrunk
from test.workflows import (
assert_complete,
extract_state,
run_workflow,
)
@pytest.fixture()
def workflow_input_data(faker, nokia_router_subscription_factory):
return {
"partner": "GEANT",
"geant_s_sid": faker.geant_sid(),
"iptrunk_description": faker.sentence(),
"iptrunk_type": IptrunkType.DARK_FIBER,
"iptrunk_speed": PhysicalPortCapacity.FOUR_HUNDRED_GIGABIT_PER_SECOND,
"iptrunk_minimum_links": 2,
"iptrunk_isis_metric": 10000,
"side_a_node_id": nokia_router_subscription_factory(),
"side_a_ae_iface": faker.network_interface(),
"side_a_ae_geant_a_sid": faker.geant_sid(),
"side_a_ae_members": [
{"interface_name": faker.network_interface(), "interface_description": faker.sentence()} for _ in range(3)
],
"side_b_node_id": nokia_router_subscription_factory(),
"side_b_ae_iface": faker.network_interface(),
"side_b_ae_geant_a_sid": faker.geant_sid(),
"side_b_ae_members": [
{"interface_name": faker.network_interface(), "interface_description": faker.sentence()} for _ in range(3)
],
"iptrunk_ipv4_network": faker.ipv4_network(max_subnet=31),
"iptrunk_ipv6_network": faker.ipv6_network(max_subnet=126),
}
@pytest.mark.workflow()
def test_create_imported_iptrunk_success(workflow_input_data):
result, _, _ = run_workflow("create_imported_iptrunk", [workflow_input_data])
state = extract_state(result)
imported_router = ImportedIptrunk.from_subscription(state["subscription_id"])
assert_complete(result)
assert imported_router.product.name == ProductName.IMPORTED_IP_TRUNK
assert imported_router.status == SubscriptionLifecycle.ACTIVE
Loading