diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-04-29 20:54:36 -0500 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-08 20:08:06 -0500 |
commit | ef5cee3ab578c2fde8ca6cc636f10acfdb79f123 (patch) | |
tree | 02510944a5782a9c4047234b747fdc02dd8f31c8 /src/mm-iface-modem-firmware.c | |
parent | 7262b46a82642b7232ef922b827d77626a93eec0 (diff) |
auth-provider: move auth provider logic into each class
Rather than make all of them rely on MMBaseModem for it. This
lets us disentangle dependencies for easier unit testing.
For interfaces, rather than casting directly to MMBaseModem
use intermediate interfaces (MMIfaceAuth and MMIfaceOpLock)
that tests can fake out.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/mm-iface-modem-firmware.c')
-rw-r--r-- | src/mm-iface-modem-firmware.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mm-iface-modem-firmware.c b/src/mm-iface-modem-firmware.c index c71254c4..f13e4a4c 100644 --- a/src/mm-iface-modem-firmware.c +++ b/src/mm-iface-modem-firmware.c @@ -180,13 +180,14 @@ load_list_ready (MMIfaceModemFirmware *self, } static void -list_auth_ready (MMBaseModem *self, +list_auth_ready (MMIfaceAuth *_self, GAsyncResult *res, HandleListContext *ctx) { + MMIfaceModemFirmware *self = MM_IFACE_MODEM_FIRMWARE (_self); GError *error = NULL; - if (!mm_base_modem_authorize_finish (self, res, &error)) { + if (!mm_iface_auth_authorize_finish (_self, res, &error)) { mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_list_context_free (ctx); return; @@ -221,7 +222,7 @@ handle_list (MmGdbusModemFirmware *skeleton, ctx->invocation = g_object_ref (invocation); ctx->self = g_object_ref (self); - mm_base_modem_authorize (MM_BASE_MODEM (self), + mm_iface_auth_authorize (MM_IFACE_AUTH (self), invocation, MM_AUTHORIZATION_FIRMWARE, (GAsyncReadyCallback)list_auth_ready, @@ -265,13 +266,14 @@ change_current_ready (MMIfaceModemFirmware *self, } static void -select_auth_ready (MMBaseModem *self, +select_auth_ready (MMIfaceAuth *_self, GAsyncResult *res, HandleSelectContext *ctx) { + MMIfaceModemFirmware *self = MM_IFACE_MODEM_FIRMWARE (_self); GError *error = NULL; - if (!mm_base_modem_authorize_finish (self, res, &error)) { + if (!mm_iface_auth_authorize_finish (_self, res, &error)) { mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_select_context_free (ctx); return; @@ -308,7 +310,7 @@ handle_select (MmGdbusModemFirmware *skeleton, ctx->self = g_object_ref (self); ctx->name = g_strdup (name); - mm_base_modem_authorize (MM_BASE_MODEM (self), + mm_iface_auth_authorize (MM_IFACE_AUTH (self), invocation, MM_AUTHORIZATION_FIRMWARE, (GAsyncReadyCallback)select_auth_ready, |