Skip to content
Snippets Groups Projects
Commit 4cfe6542 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Add unit tests for importing office routers and super pop switches

parent 924c0dd1
No related branches found
No related tags found
1 merge request!213Add unit tests for imported products
......@@ -50,6 +50,7 @@ def site_subscription_factory(faker, geant_partner):
site_ts_address=None,
status: SubscriptionLifecycle | None = None,
partner: dict | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
......@@ -115,6 +116,7 @@ def nokia_router_subscription_factory(site_subscription_factory, faker, geant_pa
router_site=None,
status: SubscriptionLifecycle | None = None,
partner: dict | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
......@@ -180,6 +182,7 @@ def juniper_router_subscription_factory(site_subscription_factory, faker, geant_
router_site=None,
status: SubscriptionLifecycle | None = None,
partner: dict | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
......@@ -283,6 +286,7 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant
iptrunk_sides=None,
status: SubscriptionLifecycle | None = None,
partner: dict | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
......@@ -350,6 +354,7 @@ def office_router_subscription_factory(site_subscription_factory, faker, geant_p
office_router_site=None,
status: SubscriptionLifecycle | None = None,
partner: dict | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
......@@ -408,6 +413,7 @@ def super_pop_switch_subscription_factory(site_subscription_factory, faker, gean
super_pop_switch_site=None,
status: SubscriptionLifecycle | None = None,
partner: dict | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
......
import pytest
from orchestrator.types import SubscriptionLifecycle
from products import ProductName
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 (
......
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.office_router import ImportedOfficeRouter
from gso.products.product_types.site import Site
from test.workflows import (
assert_complete,
extract_state,
run_workflow,
)
@pytest.mark.workflow()
def test_create_imported_office_router_success(faker, site_subscription_factory):
input_data = {
"partner": "GEANT",
"office_router_site": Site.from_subscription(site_subscription_factory()).site.site_name,
"office_router_fqdn": faker.domain_name(levels=4),
"office_router_ts_port": faker.port_number(is_user=True),
"office_router_lo_ipv4_address": faker.ipv4(),
"office_router_lo_ipv6_address": faker.ipv6(),
}
result, _, _ = run_workflow("create_imported_office_router", [input_data])
state = extract_state(result)
imported_office_router = ImportedOfficeRouter.from_subscription(state["subscription_id"])
assert_complete(result)
assert imported_office_router.product.name == ProductName.IMPORTED_OFFICE_ROUTER
assert imported_office_router.status == SubscriptionLifecycle.ACTIVE
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.office_router import OfficeRouter
from test.workflows import assert_complete, run_workflow
@pytest.mark.workflow()
def test_import_office_router_success(office_router_subscription_factory):
imported_office_router = office_router_subscription_factory(is_imported=False)
result, _, _ = run_workflow("import_office_router", [{"subscription_id": imported_office_router}])
subscription = OfficeRouter.from_subscription(imported_office_router)
assert_complete(result)
assert subscription.product.name == ProductName.OFFICE_ROUTER
assert subscription.status == SubscriptionLifecycle.ACTIVE
assert subscription.insync
import pytest
from orchestrator.types import SubscriptionLifecycle
from products.product_blocks.site import SiteTier
from gso.products.product_blocks.site import SiteTier
from gso.products.product_types.site import ImportedSite
from test.workflows import assert_complete, extract_state, run_workflow
......
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.site import Site
from gso.products.product_types.super_pop_switch import ImportedSuperPopSwitch
from test.workflows import (
assert_complete,
extract_state,
run_workflow,
)
@pytest.mark.workflow()
def test_create_imported_office_router_success(faker, site_subscription_factory):
input_data = {
"partner": "GEANT",
"hostname": faker.domain_word(),
"super_pop_switch_site": Site.from_subscription(site_subscription_factory()).site.site_name,
"super_pop_switch_ts_port": faker.port_number(is_user=True),
"super_pop_switch_mgmt_ipv4_address": faker.ipv4(),
}
result, _, _ = run_workflow("create_imported_super_pop_switch", [input_data])
state = extract_state(result)
imported_super_pop_switch = ImportedSuperPopSwitch.from_subscription(state["subscription_id"])
assert_complete(result)
assert imported_super_pop_switch.product.name == ProductName.IMPORTED_SUPER_POP_SWITCH
assert imported_super_pop_switch.status == SubscriptionLifecycle.ACTIVE
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.super_pop_switch import SuperPopSwitch
from test.workflows import assert_complete, run_workflow
@pytest.mark.workflow()
def test_import_super_pop_switch_success(super_pop_switch_subscription_factory):
imported_super_pop_switch = super_pop_switch_subscription_factory(is_imported=False)
result, _, _ = run_workflow("import_super_pop_switch", [{"subscription_id": imported_super_pop_switch}])
subscription = SuperPopSwitch.from_subscription(imported_super_pop_switch)
assert_complete(result)
assert subscription.product.name == ProductName.SUPER_POP_SWITCH
assert subscription.status == SubscriptionLifecycle.ACTIVE
assert subscription.insync
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