Skip to content
Snippets Groups Projects
Commit 486d133d authored by Neda Moeini's avatar Neda Moeini
Browse files

Update placement port fixtures to use shared imported map and update product class references

parent 038dc6c0
No related branches found
No related tags found
No related merge requests found
Pipeline #95656 failed
......@@ -8,20 +8,14 @@ from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_blocks.l3_interface_port import L3InterfacePortBlockInactive
from gso.products.product_types.edge_port import EdgePort
from gso.products.product_types.ix_port import ImportedIXPort, ImportedIXPortInactive
from gso.products.product_types.ix_port import ImportedIXPort, IXPortInactive
from gso.products.product_types.private_peer_port import ImportedPrivatePeerPort, PrivatePeerPortInactive
from gso.products.product_types.transit_provider_port import (
ImportedTransitProviderPort,
ImportedTransitProviderPortInactive,
TransitProviderPortInactive,
)
from gso.services.subscriptions import get_product_id_by_name
PRODUCT_IMPORTED_MAP = {
ProductName.IX_PORT: ImportedIXPort,
ProductName.PRIVATE_PEER_PORT: ImportedPrivatePeerPort,
ProductName.TRANSIT_PROVIDER_PORT: ImportedTransitProviderPort,
}
from gso.workflows.placement_port.shared import PLACEMENT_PORT_PRODUCT_IMPORTED_MAP
@pytest.fixture
......@@ -72,7 +66,8 @@ def make_placement_port_subscription_factory(
status: SubscriptionLifecycle | None = None,
is_imported: bool | None = False,
) -> SubscriptionModel:
product_id = get_product_id_by_name(PRODUCT_IMPORTED_MAP[product_name] if is_imported else product_name)
product = PLACEMENT_PORT_PRODUCT_IMPORTED_MAP[product_name] if is_imported else product_name
product_id = get_product_id_by_name(product.name if hasattr(product, "name") else product)
subscription_class = imported_class if is_imported else native_class
partner = partner or partner_factory()
subscription = subscription_class.from_product_id(product_id, partner["partner_id"], insync=True)
......@@ -99,7 +94,7 @@ def ix_port_subscription_factory(make_placement_port_subscription_factory):
return make_placement_port_subscription_factory(
product_name=ProductName.IX_PORT,
imported_class=ImportedIXPort,
native_class=ImportedIXPortInactive,
native_class=IXPortInactive,
*args, # noqa: B026
**kwargs,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment