[tracker/sam/umockdev: 2/3] trackertestutils: Add helper function to dconf module



commit a844ad0d06a1c287a3314d9d296fa3ddd3cae180
Author: Sam Thursfield <sam afuera me uk>
Date:   Fri May 22 20:58:54 2020 +0200

    trackertestutils: Add helper function to dconf module
    
    This saves a small amount of copy-paste code in tracker-miners.git.

 utils/trackertestutils/sandbox.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/utils/trackertestutils/sandbox.py b/utils/trackertestutils/sandbox.py
index e9fd85363..2036faaeb 100644
--- a/utils/trackertestutils/sandbox.py
+++ b/utils/trackertestutils/sandbox.py
@@ -29,6 +29,7 @@ import os
 import signal
 
 from . import dbusdaemon
+from . import dconf
 from . import psutil_mini as psutil
 
 log = logging.getLogger(__name__)
@@ -129,3 +130,21 @@ class TrackerSandbox:
 
     def get_connection(self):
         return self.daemon.get_connection()
+
+    def set_config(self, schema_config_dict):
+        """Set config values in multiple GSettings schemas.
+
+        Example input:
+
+            set_all({
+                'org.freedesktop.Tracker3.Miner.Files': {
+                    'enable-writeback': GLib.Variant.new_boolean(False),
+                }
+            })
+
+        """
+
+        for schema_name, contents in schema_config_dict.items():
+            dconfclient = dconf.DConfClient(self)
+            for key, value in contents.items():
+                dconfclient.write(schema_name, key, value)


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