]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gp: Check correct variables
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 25 Aug 2023 01:59:06 +0000 (13:59 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 Aug 2023 02:15:29 +0000 (02:15 +0000)
We were intending to check the keys, not the certificates.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/gpo.py

index d59cb06b5658f4ecfba35c41aef7de629a14dcf3..bb1ab49fae1095eb03b123cfee7329b6560ded24 100644 (file)
@@ -6944,7 +6944,7 @@ class GPOTests(tests.TestCase):
             self.assertTrue(os.path.exists(machine_crt),
                             'Machine certificate was not requested')
             machine_key = os.path.join(dname, '%s.Machine.key' % ca_cn)
-            self.assertTrue(os.path.exists(machine_crt),
+            self.assertTrue(os.path.exists(machine_key),
                             'Machine key was not generated')
 
             # Subsequent apply should react to new certificate templates
@@ -6955,13 +6955,13 @@ class GPOTests(tests.TestCase):
                             'Root CA certificate was not requested')
             self.assertTrue(os.path.exists(machine_crt),
                             'Machine certificate was not requested')
-            self.assertTrue(os.path.exists(machine_crt),
+            self.assertTrue(os.path.exists(machine_key),
                             'Machine key was not generated')
             workstation_crt = os.path.join(dname, '%s.Workstation.crt' % ca_cn)
             self.assertTrue(os.path.exists(workstation_crt),
                             'Workstation certificate was not requested')
             workstation_key = os.path.join(dname, '%s.Workstation.key' % ca_cn)
-            self.assertTrue(os.path.exists(workstation_crt),
+            self.assertTrue(os.path.exists(workstation_key),
                             'Workstation key was not generated')
 
             # Verify RSOP does not fail
@@ -6980,11 +6980,11 @@ class GPOTests(tests.TestCase):
                             'Root CA certificate was not removed')
             self.assertFalse(os.path.exists(machine_crt),
                             'Machine certificate was not removed')
-            self.assertFalse(os.path.exists(machine_crt),
+            self.assertFalse(os.path.exists(machine_key),
                             'Machine key was not removed')
             self.assertFalse(os.path.exists(workstation_crt),
                             'Workstation certificate was not removed')
-            self.assertFalse(os.path.exists(workstation_crt),
+            self.assertFalse(os.path.exists(workstation_key),
                             'Workstation key was not removed')
 
             # Reapply policy by staging the enabled pol file
@@ -6996,11 +6996,11 @@ class GPOTests(tests.TestCase):
                             'Root CA certificate was not requested')
             self.assertTrue(os.path.exists(machine_crt),
                             'Machine certificate was not requested')
-            self.assertTrue(os.path.exists(machine_crt),
+            self.assertTrue(os.path.exists(machine_key),
                             'Machine key was not generated')
             self.assertTrue(os.path.exists(workstation_crt),
                             'Workstation certificate was not requested')
-            self.assertTrue(os.path.exists(workstation_crt),
+            self.assertTrue(os.path.exists(workstation_key),
                             'Workstation key was not generated')
 
             # Remove policy
@@ -7011,11 +7011,11 @@ class GPOTests(tests.TestCase):
                             'Root CA certificate was not removed')
             self.assertFalse(os.path.exists(machine_crt),
                             'Machine certificate was not removed')
-            self.assertFalse(os.path.exists(machine_crt),
+            self.assertFalse(os.path.exists(machine_key),
                             'Machine key was not removed')
             self.assertFalse(os.path.exists(workstation_crt),
                             'Workstation certificate was not removed')
-            self.assertFalse(os.path.exists(workstation_crt),
+            self.assertFalse(os.path.exists(workstation_key),
                             'Workstation key was not removed')
             out, _ = Popen(['getcert', 'list-cas'], stdout=PIPE).communicate()
             self.assertNotIn(get_bytes(ca_cn), out, 'CA was not removed')
@@ -7554,7 +7554,7 @@ class GPOTests(tests.TestCase):
                 self.assertTrue(os.path.exists(machine_crt),
                                 'Machine certificate was not requested')
                 machine_key = os.path.join(dname, '%s.Machine.key' % ca)
-                self.assertTrue(os.path.exists(machine_crt),
+                self.assertTrue(os.path.exists(machine_key),
                                 'Machine key was not generated')
 
             # Subsequent apply should react to new certificate templates
@@ -7566,14 +7566,14 @@ class GPOTests(tests.TestCase):
                                 'Root CA certificate was not requested')
                 self.assertTrue(os.path.exists(machine_crt),
                                 'Machine certificate was not requested')
-                self.assertTrue(os.path.exists(machine_crt),
+                self.assertTrue(os.path.exists(machine_key),
                                 'Machine key was not generated')
 
                 workstation_crt = os.path.join(dname, '%s.Workstation.crt' % ca)
                 self.assertTrue(os.path.exists(workstation_crt),
                                 'Workstation certificate was not requested')
                 workstation_key = os.path.join(dname, '%s.Workstation.key' % ca)
-                self.assertTrue(os.path.exists(workstation_crt),
+                self.assertTrue(os.path.exists(workstation_key),
                                 'Workstation key was not generated')
 
             # Verify RSOP does not fail
@@ -7591,11 +7591,11 @@ class GPOTests(tests.TestCase):
                             'Root CA certificate was not removed')
             self.assertFalse(os.path.exists(machine_crt),
                             'Machine certificate was not removed')
-            self.assertFalse(os.path.exists(machine_crt),
+            self.assertFalse(os.path.exists(machine_key),
                             'Machine key was not removed')
             self.assertFalse(os.path.exists(workstation_crt),
                             'Workstation certificate was not removed')
-            self.assertFalse(os.path.exists(workstation_crt),
+            self.assertFalse(os.path.exists(workstation_key),
                             'Workstation key was not removed')
             out, _ = Popen(['getcert', 'list-cas'], stdout=PIPE).communicate()
             for ca in ca_list: