[mutter] tests/dbusmock/colord: Implement FindProfileById



commit a2000a1132e45225e634b540deddd522063dee48
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Sep 13 18:15:37 2022 +0200

    tests/dbusmock/colord: Implement FindProfileById
    
    It's used when cleaning up profiles on race conditions.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2622>

 src/tests/dbusmock-templates/colord.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/src/tests/dbusmock-templates/colord.py b/src/tests/dbusmock-templates/colord.py
index 30b7faa10b..d81f337803 100644
--- a/src/tests/dbusmock-templates/colord.py
+++ b/src/tests/dbusmock-templates/colord.py
@@ -57,6 +57,9 @@ def profile_id_from_path(mock, path):
 class ColordAlreadyExistsException(dbus.DBusException):
     _dbus_error_name = 'org.freedesktop.ColorManager.AlreadyExists'
 
+class ColordNotFoundException(dbus.DBusException):
+    _dbus_error_name = 'org.freedesktop.ColorManager.NotFound'
+
 
 @dbus.service.method(MAIN_IFACE, in_signature='ssa{sv}', out_signature='o')
 def CreateDevice(self, device_id, scope, props):
@@ -122,6 +125,14 @@ def DeleteProfile(self, profile_path):
     self.EmitSignal(MAIN_IFACE, 'ProfileRemoved', 'o', [profile_path])
 
 
+@dbus.service.method(MAIN_IFACE, in_signature='s', out_signature='o')
+def FindProfileById(self, profile_id):
+    if profile_id in self.devices:
+        return self.devices[profile_id]
+    else:
+        raise ColordNotFoundException()
+
+
 @dbus.service.method(MOCK_IFACE)
 def Reset(self):
     for device_path in self.devices.values():


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]