python/tests: add TestCase.get_loadparm(s3=True) support
authorStefan Metzmacher <metze@samba.org>
Fri, 12 Jan 2024 15:56:58 +0000 (16:56 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 26 Jan 2024 17:00:33 +0000 (17:00 +0000)
This will be used for tests with registry shares,
as the top level loadparm system doesn't support them.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
python/samba/tests/__init__.py

index 6a28c0de4c0684bce63736b9880edd50a293c4ce..136dd2fc31697598a93775b717b27585fe553571 100644 (file)
@@ -194,8 +194,8 @@ class TestCase(unittest.TestCase):
             self.addCleanup(samba.set_debug_level, test_debug_level)
 
     @classmethod
-    def get_loadparm(cls):
-        return env_loadparm()
+    def get_loadparm(cls, s3=False):
+        return env_loadparm(s3=s3)
 
     def get_credentials(self):
         return cmdline_credentials
@@ -424,15 +424,19 @@ class TestCaseInTempDir(TestCase):
         self.rm_files(*dirs, allow_missing=allow_missing, _rm=shutil.rmtree)
 
 
-def env_loadparm():
-    lp = param.LoadParm()
+def env_loadparm(s3=False):
+    if s3:
+        from samba.samba3 import param as s3param
+        lp = s3param.get_context()
+    else:
+        lp = param.LoadParm()
+
     try:
         lp.load(os.environ["SMB_CONF_PATH"])
     except KeyError:
         raise KeyError("SMB_CONF_PATH not set")
     return lp
 
-
 def env_get_var_value(var_name, allow_missing=False):
     """Returns value for variable in os.environ