48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
from integration_topology import IntegrationEndpoint, IntegrationKind, IntegrationTopology
|
|
from integration_topology import build_integration_topology
|
|
from semantic_kernel import index_project
|
|
|
|
|
|
def test_integration_topology_filters_by_kind():
|
|
topology = IntegrationTopology(
|
|
project_id="demo",
|
|
endpoints=[
|
|
IntegrationEndpoint(
|
|
endpoint_id="endpoint.1",
|
|
name="OrdersApi",
|
|
kind=IntegrationKind.HTTP_SERVICE,
|
|
)
|
|
],
|
|
)
|
|
|
|
assert topology.by_kind(IntegrationKind.HTTP_SERVICE)[0].name == "OrdersApi"
|
|
|
|
|
|
def test_build_integration_topology_from_bsl_and_exchange_plan(tmp_path):
|
|
module = tmp_path / "integration.bsl"
|
|
module.write_text(
|
|
"""
|
|
Процедура ОтправитьЗаказ()
|
|
Соединение = Новый HTTPСоединение("api.example.local");
|
|
Адрес = "https://api.example.local/orders";
|
|
Объект = Новый COMОбъект("V83.Application");
|
|
КонецПроцедуры
|
|
""",
|
|
encoding="utf-8",
|
|
)
|
|
(tmp_path / "metadata.xml").write_text(
|
|
"""
|
|
<Configuration>
|
|
<ExchangePlan name="ОбменСКассой" qualifiedName="ПланОбмена.ОбменСКассой" />
|
|
</Configuration>
|
|
""",
|
|
encoding="utf-8",
|
|
)
|
|
snapshot = index_project(tmp_path, project_id="integrations")
|
|
|
|
topology = build_integration_topology(snapshot)
|
|
|
|
assert topology.by_kind(IntegrationKind.HTTP_SERVICE)
|
|
assert topology.by_kind(IntegrationKind.COM_CONNECTOR)[0].name == "COMObject"
|
|
assert topology.by_kind(IntegrationKind.EXCHANGE_PLAN)[0].name == "ОбменСКассой"
|