]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gp: Use assertEqual() instead of assertEquals()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 29 Aug 2023 04:27:04 +0000 (16:27 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 Aug 2023 02:15:29 +0000 (02:15 +0000)
assertEquals() is deprecated and could be removed in a future version of
Python.

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

index bb1ab49fae1095eb03b123cfee7329b6560ded24..744c348302aedd523293e6ad9348e252184abe43 100644 (file)
@@ -5336,7 +5336,7 @@ class GPOTests(tests.TestCase):
             with TemporaryDirectory(sections[keyname]) as dname:
                 ext.process_group_policy([], gpos, dname)
                 scripts = os.listdir(dname)
-                self.assertEquals(len(scripts), 1,
+                self.assertEqual(len(scripts), 1,
                     'The %s script was not created' % keyname.decode())
                 out, _ = Popen([os.path.join(dname, scripts[0])], stdout=PIPE).communicate()
                 self.assertIn(b'hello world', out,
@@ -5344,14 +5344,14 @@ class GPOTests(tests.TestCase):
 
                 # Check that a call to gpupdate --rsop also succeeds
                 ret = rsop(self.lp)
-                self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+                self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
                 # Remove policy
                 gp_db = store.get_gplog(machine_creds.get_username())
                 del_gpos = get_deleted_gpos_list(gp_db, [])
                 ext.process_group_policy(del_gpos, [])
-                self.assertEquals(len(os.listdir(dname)), 0,
-                                  'Unapply failed to cleanup scripts')
+                self.assertEqual(len(os.listdir(dname)), 0,
+                                 'Unapply failed to cleanup scripts')
 
             # Unstage the Registry.pol file
             unstage_file(reg_pol)
@@ -5391,21 +5391,21 @@ class GPOTests(tests.TestCase):
         with TemporaryDirectory() as dname:
             ext.process_group_policy([], gpos, dname)
             sudoers = os.listdir(dname)
-            self.assertEquals(len(sudoers), 1, 'The sudoer file was not created')
+            self.assertEqual(len(sudoers), 1, 'The sudoer file was not created')
             self.assertIn(e.data,
                     open(os.path.join(dname, sudoers[0]), 'r').read(),
                     'The sudoers entry was not applied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
             del_gpos = get_deleted_gpos_list(gp_db, [])
             ext.process_group_policy(del_gpos, [])
-            self.assertEquals(len(os.listdir(dname)), 0,
-                              'Unapply failed to cleanup scripts')
+            self.assertEqual(len(os.listdir(dname)), 0,
+                             'Unapply failed to cleanup scripts')
 
         # Unstage the Registry.pol file
         unstage_file(reg_pol)
@@ -5486,7 +5486,7 @@ class GPOTests(tests.TestCase):
         with TemporaryDirectory() as dname:
             ext.process_group_policy([], gpos, dname)
             sudoers = os.listdir(dname)
-            self.assertEquals(len(sudoers), 3, 'The sudoer file was not created')
+            self.assertEqual(len(sudoers), 3, 'The sudoer file was not created')
             output = open(os.path.join(dname, sudoers[0]), 'r').read() + \
                      open(os.path.join(dname, sudoers[1]), 'r').read() + \
                      open(os.path.join(dname, sudoers[2]), 'r').read()
@@ -5499,14 +5499,14 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
             del_gpos = get_deleted_gpos_list(gp_db, [])
             ext.process_group_policy(del_gpos, [])
-            self.assertEquals(len(os.listdir(dname)), 0,
-                              'Unapply failed to cleanup scripts')
+            self.assertEqual(len(os.listdir(dname)), 0,
+                             'Unapply failed to cleanup scripts')
 
         # Unstage the Registry.pol file
         unstage_file(manifest)
@@ -5532,8 +5532,8 @@ class GPOTests(tests.TestCase):
                 self.fail('Failed to parse utf-16')
             self.assertIn('Kerberos Policy', inf_conf.keys(),
                           'Kerberos Policy was not read from the file')
-            self.assertEquals(inf_conf.get('Kerberos Policy', 'MaxTicketAge'),
-                              '99', 'MaxTicketAge was not read from the file')
+            self.assertEqual(inf_conf.get('Kerberos Policy', 'MaxTicketAge'),
+                             '99', 'MaxTicketAge was not read from the file')
 
         with NamedTemporaryFile() as f:
             with codecs.open(f.name, 'w', 'utf-8') as w:
@@ -5541,8 +5541,8 @@ class GPOTests(tests.TestCase):
             inf_conf = ext.read(f.name)
             self.assertIn('Kerberos Policy', inf_conf.keys(),
                           'Kerberos Policy was not read from the file')
-            self.assertEquals(inf_conf.get('Kerberos Policy', 'MaxTicketAge'),
-                              '99', 'MaxTicketAge was not read from the file')
+            self.assertEqual(inf_conf.get('Kerberos Policy', 'MaxTicketAge'),
+                             '99', 'MaxTicketAge was not read from the file')
 
     def test_rsop(self):
         cache_dir = self.lp.get('cache directory')
@@ -5606,8 +5606,8 @@ class GPOTests(tests.TestCase):
                 ext = ext(self.lp, machine_creds,
                           machine_creds.get_username(), store)
                 ret = ext.rsop(g)
-                self.assertEquals(len(ret.keys()), 1,
-                                  'A single policy should have been displayed')
+                self.assertEqual(len(ret.keys()), 1,
+                                 'A single policy should have been displayed')
 
                 # Check the Security Extension
                 if type(ext) == gp_krb_ext:
@@ -5615,8 +5615,8 @@ class GPOTests(tests.TestCase):
                                   'Kerberos Policy not found')
                     self.assertIn('MaxTicketAge', ret['Kerberos Policy'],
                                   'MaxTicketAge setting not found')
-                    self.assertEquals(ret['Kerberos Policy']['MaxTicketAge'], '99',
-                                      'MaxTicketAge was not set to 99')
+                    self.assertEqual(ret['Kerberos Policy']['MaxTicketAge'], '99',
+                                     'MaxTicketAge was not set to 99')
                 # Check the Scripts Extension
                 elif type(ext) == gp_scripts_ext:
                     self.assertIn('Daily Scripts', ret.keys(),
@@ -5636,18 +5636,18 @@ class GPOTests(tests.TestCase):
                                   'apply group policies was not applied')
                     self.assertIn(e3.valuename, ret['smb.conf'],
                                   'apply group policies was not applied')
-                    self.assertEquals(ret['smb.conf'][e3.valuename], e3.data,
-                                      'apply group policies was not set')
+                    self.assertEqual(ret['smb.conf'][e3.valuename], e3.data,
+                                     'apply group policies was not set')
                 # Check the Messages Extension
                 elif type(ext) == gp_msgs_ext:
                     self.assertIn('/etc/issue', ret,
                                   'Login Prompt Message not applied')
-                    self.assertEquals(ret['/etc/issue'], e4.data,
-                                      'Login Prompt Message not set')
+                    self.assertEqual(ret['/etc/issue'], e4.data,
+                                     'Login Prompt Message not set')
 
                 # Check that a call to gpupdate --rsop also succeeds
                 ret = rsop(self.lp)
-                self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+                self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             unstage_file(gpofile % g.name)
             unstage_file(reg_pol % g.name)
@@ -5801,13 +5801,13 @@ class GPOTests(tests.TestCase):
             lp = LoadParm(f.name)
 
             template_homedir = lp.get('template homedir')
-            self.assertEquals(template_homedir, '/home/samba/%D/%U',
-                              'template homedir was not applied')
+            self.assertEqual(template_homedir, '/home/samba/%D/%U',
+                             'template homedir was not applied')
             apply_group_policies = lp.get('apply group policies')
             self.assertFalse(apply_group_policies,
                             'apply group policies was not applied')
             ldap_timeout = lp.get('ldap timeout')
-            self.assertEquals(ldap_timeout, 9999, 'ldap timeout was not applied')
+            self.assertEqual(ldap_timeout, 9999, 'ldap timeout was not applied')
 
             # Force apply with removal of second GPO
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -5817,17 +5817,17 @@ class GPOTests(tests.TestCase):
             lp = LoadParm(f.name)
 
             template_homedir = lp.get('template homedir')
-            self.assertEquals(template_homedir, '/home/samba/%D/%U',
-                              'template homedir was not applied')
+            self.assertEqual(template_homedir, '/home/samba/%D/%U',
+                             'template homedir was not applied')
             apply_group_policies = lp.get('apply group policies')
             self.assertTrue(apply_group_policies,
                             'apply group policies was not applied')
             ldap_timeout = lp.get('ldap timeout')
-            self.assertEquals(ldap_timeout, 9999, 'ldap timeout was not applied')
+            self.assertEqual(ldap_timeout, 9999, 'ldap timeout was not applied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             del_gpos = get_deleted_gpos_list(gp_db, [])
@@ -5836,14 +5836,14 @@ class GPOTests(tests.TestCase):
             lp = LoadParm(f.name)
 
             template_homedir = lp.get('template homedir')
-            self.assertEquals(template_homedir, self.lp.get('template homedir'),
-                              'template homedir was not unapplied')
+            self.assertEqual(template_homedir, self.lp.get('template homedir'),
+                             'template homedir was not unapplied')
             apply_group_policies = lp.get('apply group policies')
-            self.assertEquals(apply_group_policies, self.lp.get('apply group policies'),
-                              'apply group policies was not unapplied')
+            self.assertEqual(apply_group_policies, self.lp.get('apply group policies'),
+                             'apply group policies was not unapplied')
             ldap_timeout = lp.get('ldap timeout')
-            self.assertEquals(ldap_timeout, self.lp.get('ldap timeout'),
-                              'ldap timeout was not unapplied')
+            self.assertEqual(ldap_timeout, self.lp.get('ldap timeout'),
+                             'ldap timeout was not unapplied')
 
         # Unstage the Registry.pol file
         unstage_file(reg_pol)
@@ -5906,12 +5906,12 @@ class GPOTests(tests.TestCase):
             self.assertTrue(os.path.exists(motd_file),
                             'Message of the day file not created')
             data = open(motd_file, 'r').read()
-            self.assertEquals(data, e3.data, 'Message of the day not applied')
+            self.assertEqual(data, e3.data, 'Message of the day not applied')
             issue_file = os.path.join(dname, 'issue')
             self.assertTrue(os.path.exists(issue_file),
                             'Login Prompt Message file not created')
             data = open(issue_file, 'r').read()
-            self.assertEquals(data, e2.data, 'Login Prompt Message not applied')
+            self.assertEqual(data, e2.data, 'Login Prompt Message not applied')
 
             # Force apply with removal of second GPO
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -5922,16 +5922,16 @@ class GPOTests(tests.TestCase):
             self.assertTrue(os.path.exists(motd_file),
                             'Message of the day file not created')
             data = open(motd_file, 'r').read()
-            self.assertEquals(data, e1.data, 'Message of the day not applied')
+            self.assertEqual(data, e1.data, 'Message of the day not applied')
             issue_file = os.path.join(dname, 'issue')
             self.assertTrue(os.path.exists(issue_file),
                             'Login Prompt Message file not created')
             data = open(issue_file, 'r').read()
-            self.assertEquals(data, e2.data, 'Login Prompt Message not applied')
+            self.assertEqual(data, e2.data, 'Login Prompt Message not applied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Unapply policy, and ensure the test files are removed
             del_gpos = get_deleted_gpos_list(gp_db, [])
@@ -6015,7 +6015,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Unstage the manifest.xml file
         unstage_file(manifest)
@@ -6083,10 +6083,10 @@ class GPOTests(tests.TestCase):
             ext.process_group_policy([], gpos)
             self.assertTrue(os.path.exists(target.text),
                             'The target file does not exist')
-            self.assertEquals(os.stat(target.text).st_mode & 0o777, 0o755,
-                              'The target file permissions are incorrect')
-            self.assertEquals(open(target.text).read(), source_data,
-                              'The target file contents are incorrect')
+            self.assertEqual(os.stat(target.text).st_mode & 0o777, 0o755,
+                             'The target file permissions are incorrect')
+            self.assertEqual(open(target.text).read(), source_data,
+                             'The target file contents are incorrect')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6105,7 +6105,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Unstage the manifest and source files
         unstage_file(manifest)
@@ -6161,14 +6161,14 @@ class GPOTests(tests.TestCase):
         with TemporaryDirectory() as dname:
             ext.process_group_policy([], gpos, dname)
             conf = os.listdir(dname)
-            self.assertEquals(len(conf), 1, 'The conf file was not created')
+            self.assertEqual(len(conf), 1, 'The conf file was not created')
             gp_cfg = os.path.join(dname, conf[0])
             self.assertIn(data, open(gp_cfg, 'r').read(),
                     'The sshd_config entry was not applied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6226,8 +6226,8 @@ class GPOTests(tests.TestCase):
         with TemporaryDirectory() as dname:
             ext.process_group_policy([], gpos, dname)
             files = os.listdir(dname)
-            self.assertEquals(len(files), 1,
-                              'The target script was not created')
+            self.assertEqual(len(files), 1,
+                             'The target script was not created')
             entry = '@reboot %s %s %s' % (run_as.text, test_script,
                                           parameters.text)
             self.assertIn(entry,
@@ -6239,8 +6239,8 @@ class GPOTests(tests.TestCase):
             del_gpos = get_deleted_gpos_list(gp_db, [])
             ext.process_group_policy(del_gpos, [])
             files = os.listdir(dname)
-            self.assertEquals(len(files), 0,
-                              'The target script was not removed')
+            self.assertEqual(len(files), 0,
+                             'The target script was not removed')
 
             # Test rsop
             g = [g for g in gpos if g.name == guid][0]
@@ -6250,7 +6250,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Unstage the manifest.xml and script files
         unstage_file(manifest)
@@ -6272,18 +6272,18 @@ class GPOTests(tests.TestCase):
 
             ext.process_group_policy([], gpos, dname)
             files = os.listdir(dname)
-            self.assertEquals(len(files), 1,
-                              'The test file was not created')
-            self.assertEquals(files[0], os.path.basename(test_file),
-                              'The test file was not created')
+            self.assertEqual(len(files), 1,
+                             'The test file was not created')
+            self.assertEqual(files[0], os.path.basename(test_file),
+                             'The test file was not created')
 
             # Unlink the test file and ensure that processing
             # policy again does not recreate it.
             os.unlink(test_file)
             ext.process_group_policy([], gpos, dname)
             files = os.listdir(dname)
-            self.assertEquals(len(files), 0,
-                              'The test file should not have been created')
+            self.assertEqual(len(files), 0,
+                             'The test file should not have been created')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6300,7 +6300,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Unstage the manifest.xml and script files
         unstage_file(manifest)
@@ -6329,8 +6329,8 @@ class GPOTests(tests.TestCase):
             except Exception as e:
                 self.fail(str(e))
             files = os.listdir(dname)
-            self.assertEquals(len(files), 1,
-                              'The target script was not created')
+            self.assertEqual(len(files), 1,
+                             'The target script was not created')
             entry = '@reboot %s %s' % (run_as.text, test_script)
             self.assertIn(entry,
                           open(os.path.join(dname, files[0]), 'r').read(),
@@ -6341,8 +6341,8 @@ class GPOTests(tests.TestCase):
             del_gpos = get_deleted_gpos_list(gp_db, [])
             ext.process_group_policy(del_gpos, [])
             files = os.listdir(dname)
-            self.assertEquals(len(files), 0,
-                              'The target script was not removed')
+            self.assertEqual(len(files), 0,
+                             'The target script was not removed')
 
             # Test rsop
             g = [g for g in gpos if g.name == guid][0]
@@ -6352,7 +6352,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Unstage the manifest.xml and script files
         unstage_file(manifest)
@@ -6412,7 +6412,7 @@ class GPOTests(tests.TestCase):
             self.assertTrue(os.path.exists(f.name),
                             'Message of the day file not created')
             data = open(f.name, 'r').read()
-            self.assertEquals(data, text2.text, 'Message of the day not applied')
+            self.assertEqual(data, text2.text, 'Message of the day not applied')
 
             # Force apply with removal of second GPO
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6420,12 +6420,12 @@ class GPOTests(tests.TestCase):
             gpos = [gpo for gpo in gpos if gpo.name != guids[1]]
             ext.process_group_policy(del_gpos, gpos, f.name)
 
-            self.assertEquals(open(f.name, 'r').read(), text.text,
-                              'The motd was not applied')
+            self.assertEqual(open(f.name, 'r').read(), text.text,
+                             'The motd was not applied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             del_gpos = get_deleted_gpos_list(gp_db, [])
@@ -6488,8 +6488,8 @@ class GPOTests(tests.TestCase):
         # Process all gpos, with temp output directory
         with NamedTemporaryFile() as f:
             ext.process_group_policy([], gpos, f.name)
-            self.assertEquals(open(f.name, 'r').read(), text2.text,
-                              'The issue was not applied')
+            self.assertEqual(open(f.name, 'r').read(), text2.text,
+                             'The issue was not applied')
 
             # Force apply with removal of second GPO
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6497,12 +6497,12 @@ class GPOTests(tests.TestCase):
             gpos = [gpo for gpo in gpos if gpo.name != guids[1]]
             ext.process_group_policy(del_gpos, gpos, f.name)
 
-            self.assertEquals(open(f.name, 'r').read(), text.text,
-                              'The issue was not applied')
+            self.assertEqual(open(f.name, 'r').read(), text.text,
+                             'The issue was not applied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             del_gpos = get_deleted_gpos_list(gp_db, [])
@@ -6624,7 +6624,7 @@ class GPOTests(tests.TestCase):
             ext.process_group_policy([], gpos, dname)
             conf = os.listdir(dname)
             # There will be 2 files, the policy file and the deny file
-            self.assertEquals(len(conf), 2, 'The conf file was not created')
+            self.assertEqual(len(conf), 2, 'The conf file was not created')
             # Ignore the DENY_ALL conf file
             gp_cfg = os.path.join(dname,
                 [c for c in conf if '_gp_DENY_ALL.conf' not in c][0])
@@ -6639,7 +6639,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6685,7 +6685,7 @@ class GPOTests(tests.TestCase):
                             'Local db dir not created')
             def db_check(name, data, count=1):
                 db = glob(os.path.join(local_db, '*-%s' % name))
-                self.assertEquals(len(db), count, '%s not created' % name)
+                self.assertEqual(len(db), count, '%s not created' % name)
                 file_contents = ConfigParser()
                 file_contents.read(db)
                 for key in data.keys():
@@ -6699,14 +6699,14 @@ class GPOTests(tests.TestCase):
 
             def del_db_check(name):
                 db = glob(os.path.join(local_db, '*-%s' % name))
-                self.assertEquals(len(db), 0, '%s not deleted' % name)
+                self.assertEqual(len(db), 0, '%s not deleted' % name)
 
             locks = os.path.join(local_db, 'locks')
             self.assertTrue(os.path.isdir(local_db), 'Locks dir not created')
             def lock_check(name, items, count=1):
                 lock = glob(os.path.join(locks, '*%s' % name))
-                self.assertEquals(len(lock), count,
-                                  '%s lock not created' % name)
+                self.assertEqual(len(lock), count,
+                                 '%s lock not created' % name)
                 file_contents = []
                 for i in range(count):
                     file_contents.extend(open(lock[i], 'r').read().split('\n'))
@@ -6716,7 +6716,7 @@ class GPOTests(tests.TestCase):
 
             def del_lock_check(name):
                 lock = glob(os.path.join(locks, '*%s' % name))
-                self.assertEquals(len(lock), 0, '%s lock not deleted' % name)
+                self.assertEqual(len(lock), 0, '%s lock not deleted' % name)
 
             # Check the user profile
             user_profile = os.path.join(dname, 'etc/dconf/profile/user')
@@ -6787,24 +6787,24 @@ class GPOTests(tests.TestCase):
             actions = os.path.join(dname, 'etc/share/polkit-1/actions')
             udisk2 = glob(os.path.join(actions,
                           'org.freedesktop.[u|U][d|D]isks2.policy'))
-            self.assertEquals(len(udisk2), 1, 'udisk2 policy not created')
+            self.assertEqual(len(udisk2), 1, 'udisk2 policy not created')
             udisk2_tree = etree.fromstring(open(udisk2[0], 'r').read())
             actions = udisk2_tree.findall('action')
             md = 'org.freedesktop.udisks2.modify-device'
             action = [a for a in actions if a.attrib['id'] == md]
-            self.assertEquals(len(action), 1, 'modify-device not found')
+            self.assertEqual(len(action), 1, 'modify-device not found')
             defaults = action[0].find('defaults')
             self.assertTrue(defaults is not None,
                             'modify-device defaults not found')
             allow_any = defaults.find('allow_any').text
-            self.assertEquals(allow_any, 'no',
-                              'modify-device allow_any not set to no')
+            self.assertEqual(allow_any, 'no',
+                             'modify-device allow_any not set to no')
             allow_inactive = defaults.find('allow_inactive').text
-            self.assertEquals(allow_inactive, 'no',
-                              'modify-device allow_inactive not set to no')
+            self.assertEqual(allow_inactive, 'no',
+                             'modify-device allow_inactive not set to no')
             allow_active = defaults.find('allow_active').text
-            self.assertEquals(allow_active, 'yes',
-                              'modify-device allow_active not set to yes')
+            self.assertEqual(allow_active, 'yes',
+                             'modify-device allow_active not set to yes')
 
             # Disable printing
             data = { 'org/gnome/desktop/lockdown':
@@ -6843,7 +6843,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -6864,7 +6864,7 @@ class GPOTests(tests.TestCase):
             actions = os.path.join(dname, 'etc/share/polkit-1/actions')
             udisk2 = glob(os.path.join(actions,
                           'org.freedesktop.[u|U][d|D]isks2.policy'))
-            self.assertEquals(len(udisk2), 0, 'udisk2 policy not deleted')
+            self.assertEqual(len(udisk2), 0, 'udisk2 policy not deleted')
             del_db_check('printing')
             del_lock_check('printing')
             del_db_check('filesaving')
@@ -6969,7 +6969,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy by staging pol file with auto-enroll unchecked
             parser.load_xml(etree.fromstring(auto_enroll_unchecked_reg_pol.strip()))
@@ -7115,7 +7115,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             del_gpos = get_deleted_gpos_list(gp_db, [])
@@ -7212,7 +7212,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Unapply the policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -7295,15 +7295,15 @@ class GPOTests(tests.TestCase):
             ext.process_group_policy([], gpos, dname)
             managed = os.path.join(dname, 'managed')
             managed_files = os.listdir(managed)
-            self.assertEquals(len(managed_files), 1,
-                              'Chromium policies are missing')
+            self.assertEqual(len(managed_files), 1,
+                             'Chromium policies are missing')
             managed_file = os.path.join(managed, managed_files[0])
             with open(managed_file, 'r') as r:
                 managed_data = json.load(r)
             recommended = os.path.join(dname, 'recommended')
             recommended_files = os.listdir(recommended)
-            self.assertEquals(len(recommended_files), 1,
-                              'Chromium policies are missing')
+            self.assertEqual(len(recommended_files), 1,
+                             'Chromium policies are missing')
             recommended_file = os.path.join(recommended, recommended_files[0])
             with open(recommended_file, 'r') as r:
                 recommended_data = json.load(r)
@@ -7337,16 +7337,16 @@ class GPOTests(tests.TestCase):
 
             ext.process_group_policy([], gpos, dname)
             managed_files = os.listdir(managed)
-            self.assertEquals(len(managed_files), 1,
-                              'Number of Chromium policies is incorrect')
+            self.assertEqual(len(managed_files), 1,
+                             'Number of Chromium policies is incorrect')
             omanaged_file = managed_file
             managed_file = os.path.join(managed, managed_files[0])
             self.assertNotEqual(omanaged_file, managed_file,
                                 'The managed Chromium file did not change')
 
             recommended_files = os.listdir(recommended)
-            self.assertEquals(len(recommended_files), 1,
-                              'Number of Chromium policies is incorrect')
+            self.assertEqual(len(recommended_files), 1,
+                             'Number of Chromium policies is incorrect')
             orecommended_file = recommended_file
             recommended_file = os.path.join(recommended, recommended_files[0])
             self.assertNotEqual(orecommended_file, recommended_file,
@@ -7357,7 +7357,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Unapply the policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -7434,8 +7434,8 @@ class GPOTests(tests.TestCase):
 
         # Check that modifying the policy will enforce the correct settings
         entries = [e for e in parser.pol_file.entries if e.data != 'home']
-        self.assertEquals(len(entries), len(parser.pol_file.entries)-1,
-                          'Failed to remove the home zone entry')
+        self.assertEqual(len(entries), len(parser.pol_file.entries)-1,
+                         'Failed to remove the home zone entry')
         parser.pol_file.entries = entries
         parser.pol_file.num_entries = len(entries)
         # Stage the Registry.pol file with altered test data
@@ -7458,7 +7458,7 @@ class GPOTests(tests.TestCase):
 
         # Check that a call to gpupdate --rsop also succeeds
         ret = rsop(self.lp)
-        self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+        self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Unapply the policy
         gp_db = store.get_gplog(machine_creds.get_username())
@@ -7581,7 +7581,7 @@ class GPOTests(tests.TestCase):
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
@@ -7654,7 +7654,7 @@ class GPOTests(tests.TestCase):
         with TemporaryDirectory() as dname:
             ext.process_group_policy([], gpos, dname)
             sudoers = os.listdir(dname)
-            self.assertEquals(len(sudoers), 1, 'The sudoer file was not created')
+            self.assertEqual(len(sudoers), 1, 'The sudoer file was not created')
             sudoers_file = os.path.join(dname, sudoers[0])
             self.assertIn(e2.data, open(sudoers_file, 'r').read(),
                     'The sudoers entry was not applied')
@@ -7663,22 +7663,22 @@ class GPOTests(tests.TestCase):
             os.unlink(sudoers_file)
             ext.process_group_policy([], gpos, dname)
             sudoers = os.listdir(dname)
-            self.assertEquals(len(sudoers), 1,
-                              'The sudoer file was not recreated')
+            self.assertEqual(len(sudoers), 1,
+                             'The sudoer file was not recreated')
             sudoers_file = os.path.join(dname, sudoers[0])
             self.assertIn(e2.data, open(sudoers_file, 'r').read(),
                     'The sudoers entry was not reapplied')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
             del_gpos = get_deleted_gpos_list(gp_db, [])
             ext.process_group_policy(del_gpos, [])
-            self.assertEquals(len(os.listdir(dname)), 0,
-                              'Unapply failed to cleanup scripts')
+            self.assertEqual(len(os.listdir(dname)), 0,
+                             'Unapply failed to cleanup scripts')
 
         # Unstage the Registry.pol file
         unstage_file(reg_pol)
@@ -7719,21 +7719,21 @@ class GPOTests(tests.TestCase):
         with TemporaryDirectory() as dname:
             ext.process_group_policy([], gpos, dname)
             cron_entries = os.listdir(dname)
-            self.assertEquals(len(cron_entries), 1, 'Cron entry not created')
+            self.assertEqual(len(cron_entries), 1, 'Cron entry not created')
             fname = os.path.join(dname, cron_entries[0])
             data = open(fname, 'rb').read()
             self.assertIn(get_bytes(e.data), data, 'Cron entry is missing')
 
             # Check that a call to gpupdate --rsop also succeeds
             ret = rsop(self.lp)
-            self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+            self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
             # Remove policy
             gp_db = store.get_gplog(machine_creds.get_username())
             del_gpos = get_deleted_gpos_list(gp_db, [])
             ext.process_group_policy(del_gpos, [])
-            self.assertEquals(len(os.listdir(dname)), 0,
-                              'Unapply failed to cleanup script')
+            self.assertEqual(len(os.listdir(dname)), 0,
+                             'Unapply failed to cleanup script')
 
             # Unstage the Registry.pol file
             unstage_file(reg_pol)
@@ -7815,7 +7815,7 @@ class GPOTests(tests.TestCase):
 
         # Check that a call to gpupdate --rsop also succeeds
         ret = rsop(self.lp)
-        self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+        self.assertEqual(ret, 0, 'gpupdate --rsop failed!')
 
         # Remove policy
         del_gpos = get_deleted_gpos_list(gp_db, [])