]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Fix asserts in gpo testing
authorDavid Mulder <dmulder@suse.com>
Thu, 5 Jul 2018 15:02:57 +0000 (09:02 -0600)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 Jul 2018 20:11:22 +0000 (22:11 +0200)
These tests weren't using python's unit testing
asserts.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/gpo.py

index 796a5cb06cb3aae705174ff3976bb4a86b0eb5ab..49fb59f32b1dd4d86780cdc370bf1f20e1b3d841 100644 (file)
@@ -43,12 +43,12 @@ class GPOTests(tests.TestCase):
         file_sys_paths = [None, '%s\\%s' % (poldir, guid)]
         ds_paths = [None, 'CN=%s,%s' % (guid, dspath)]
         for i in range(0, len(gpos)):
-            assert gpos[i].name == names[i], \
-              'The gpo name did not match expected name %s' % gpos[i].name
-            assert gpos[i].file_sys_path == file_sys_paths[i], \
-              'file_sys_path did not match expected %s' % gpos[i].file_sys_path
-            assert gpos[i].ds_path == ds_paths[i], \
-              'ds_path did not match expected %s' % gpos[i].ds_path
+            self.assertEquals(gpos[i].name, names[i],
+              'The gpo name did not match expected name %s' % gpos[i].name)
+            self.assertEquals(gpos[i].file_sys_path, file_sys_paths[i],
+              'file_sys_path did not match expected %s' % gpos[i].file_sys_path)
+            self.assertEquals(gpos[i].ds_path, ds_paths[i],
+              'ds_path did not match expected %s' % gpos[i].ds_path)
 
 
     def test_gpo_ads_does_not_segfault(self):
@@ -67,11 +67,11 @@ class GPOTests(tests.TestCase):
 
         with open(os.path.join(gpo_path, 'GPT.INI'), 'w') as gpt:
             gpt.write(gpt_data % 42)
-        assert gpo.gpo_get_sysvol_gpt_version(gpo_path)[1] == 42, \
-          'gpo_get_sysvol_gpt_version() did not return the expected version'
+        self.assertEquals(gpo.gpo_get_sysvol_gpt_version(gpo_path)[1], 42,
+          'gpo_get_sysvol_gpt_version() did not return the expected version')
 
         with open(os.path.join(gpo_path, 'GPT.INI'), 'w') as gpt:
             gpt.write(gpt_data % old_vers)
-        assert gpo.gpo_get_sysvol_gpt_version(gpo_path)[1] == old_vers, \
-          'gpo_get_sysvol_gpt_version() did not return the expected version'
+        self.assertEquals(gpo.gpo_get_sysvol_gpt_version(gpo_path)[1], old_vers,
+          'gpo_get_sysvol_gpt_version() did not return the expected version')