From 91dbd23ab324bb00df32e3ee44b6069c7898d7ca Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 7 Nov 2024 09:19:48 +0800 Subject: [PATCH] tests: split mctp_mctp_endpoint_obj helper into control & common interfaces We currently have a test helper: mctpd_mctp_endpoint_obj(dbus, path) which returns the au.com.codeconstruct.MCTP.Endpoint1 interface proxy for an endpoint. However, an upcoming test will need the xyz.openbmc_project.MCTP interface, so split into _common and _control helpers. Signed-off-by: Jeremy Kerr --- tests/mctp_test_utils.py | 18 ++++++++++++++++-- tests/test_mctpd.py | 7 +++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/mctp_test_utils.py b/tests/mctp_test_utils.py index f12c3c3..7ec34ac 100644 --- a/tests/mctp_test_utils.py +++ b/tests/mctp_test_utils.py @@ -6,9 +6,23 @@ async def mctpd_mctp_iface_obj(dbus, iface): ) return await obj.get_interface('au.com.codeconstruct.MCTP.BusOwner1') -async def mctpd_mctp_endpoint_obj(dbus, path): +async def mctpd_mctp_endpoint_obj(dbus, path, iface): obj = await dbus.get_proxy_object( 'au.com.codeconstruct.MCTP1', path, ) - return await obj.get_interface('au.com.codeconstruct.MCTP.Endpoint1') + return await obj.get_interface(iface) + +async def mctpd_mctp_endpoint_control_obj(dbus, path): + return await mctpd_mctp_endpoint_obj( + dbus, + path, + 'au.com.codeconstruct.MCTP.Endpoint1' + ) + +async def mctpd_mctp_endpoint_common_obj(dbus, path): + return await mctpd_mctp_endpoint_obj( + dbus, + path, + 'xyz.openbmc_project.MCTP.Endpoint' + ) diff --git a/tests/test_mctpd.py b/tests/test_mctpd.py index 1ce332f..262917b 100644 --- a/tests/test_mctpd.py +++ b/tests/test_mctpd.py @@ -3,7 +3,10 @@ import uuid import asyncdbus -from mctp_test_utils import mctpd_mctp_iface_obj, mctpd_mctp_endpoint_obj +from mctp_test_utils import ( + mctpd_mctp_iface_obj, + mctpd_mctp_endpoint_control_obj +) from conftest import Endpoint, MCTPSockAddr # DBus constant symbol suffixes: @@ -117,7 +120,7 @@ async def test_remove_endpoint(dbus, mctpd): assert(len(mctpd.system.neighbours) == 1) - ep = await mctpd_mctp_endpoint_obj(dbus, path) + ep = await mctpd_mctp_endpoint_control_obj(dbus, path) await ep.call_remove() assert(len(mctpd.system.neighbours) == 0)