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!
2 files
+ 53
0
Compare changes
  • Side-by-side
  • Inline
Files
2
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products.product_blocks.router import RouterRole
from gso.products.product_types.router import ImportedRouter
from gso.products.product_types.site import Site
from gso.utils.helpers import iso_from_ipv4
from gso.utils.shared_enums import Vendor
from test.workflows import assert_complete, extract_state, run_workflow
@pytest.fixture()
def imported_router_creation_input_form_data(site_subscription_factory, faker):
router_site = site_subscription_factory()
fake_v4 = faker.ipv4()
return {
"partner": "GEANT",
"router_site": Site.from_subscription(router_site).site.site_name,
"hostname": faker.pystr(),
"ts_port": faker.pyint(),
"router_role": faker.random_choices(elements=(RouterRole.P, RouterRole.PE, RouterRole.AMT), length=1)[0],
"router_vendor": faker.random_choices(elements=(Vendor.NOKIA, Vendor.JUNIPER), length=1)[0],
"router_lo_ipv4_address": fake_v4,
"router_lo_ipv6_address": faker.ipv6(),
"router_lo_iso_address": iso_from_ipv4(fake_v4),
}
def test_create_imported_router_success(faker, imported_router_creation_input_form_data):
result, _, _ = run_workflow("create_imported_router", [imported_router_creation_input_form_data])
state = extract_state(result)
subscription = ImportedRouter.from_subscription(state["subscription_id"])
assert_complete(result)
assert subscription.status == SubscriptionLifecycle.ACTIVE
Loading