python: samba.tests.credentials: Fix DeprecationWarning
authorLumir Balhar <lbalhar@redhat.com>
Tue, 18 Oct 2016 12:30:28 +0000 (14:30 +0200)
committerGarming Sam <garming@samba.org>
Sun, 6 Nov 2016 22:53:10 +0000 (23:53 +0100)
For historical reasons, TestCase methods have some aliases
which are deprecated since Python 2.7.
Change "assertEquals" to the preferred name, "assertEqual".

Deprecation notice: https://docs.python.org/2/library/unittest.html#deprecated-aliases

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/credentials.py

index 95ee0fa0deb7b6e6ec87515c6e23953b107281e4..2afc2307da1e1aad4f687a5f6b8441b24d7a8493 100644 (file)
@@ -32,35 +32,35 @@ class CredentialsTests(samba.tests.TestCase):
 
     def test_set_username(self):
         self.creds.set_username("somebody")
-        self.assertEquals("somebody", self.creds.get_username())
+        self.assertEqual("somebody", self.creds.get_username())
 
     def test_set_password(self):
         self.creds.set_password("S3CreT")
-        self.assertEquals("S3CreT", self.creds.get_password())
+        self.assertEqual("S3CreT", self.creds.get_password())
 
     def test_set_domain(self):
         self.creds.set_domain("ABMAS")
-        self.assertEquals("ABMAS", self.creds.get_domain())
+        self.assertEqual("ABMAS", self.creds.get_domain())
 
     def test_set_realm(self):
         self.creds.set_realm("myrealm")
-        self.assertEquals("MYREALM", self.creds.get_realm())
+        self.assertEqual("MYREALM", self.creds.get_realm())
 
     def test_parse_string_anon(self):
         self.creds.parse_string("%")
-        self.assertEquals("", self.creds.get_username())
-        self.assertEquals(None, self.creds.get_password())
+        self.assertEqual("", self.creds.get_username())
+        self.assertEqual(None, self.creds.get_password())
 
     def test_parse_string_user_pw_domain(self):
         self.creds.parse_string("dom\\someone%secr")
-        self.assertEquals("someone", self.creds.get_username())
-        self.assertEquals("secr", self.creds.get_password())
-        self.assertEquals("DOM", self.creds.get_domain())
+        self.assertEqual("someone", self.creds.get_username())
+        self.assertEqual("secr", self.creds.get_password())
+        self.assertEqual("DOM", self.creds.get_domain())
 
     def test_bind_dn(self):
-        self.assertEquals(None, self.creds.get_bind_dn())
+        self.assertEqual(None, self.creds.get_bind_dn())
         self.creds.set_bind_dn("dc=foo,cn=bar")
-        self.assertEquals("dc=foo,cn=bar", self.creds.get_bind_dn())
+        self.assertEqual("dc=foo,cn=bar", self.creds.get_bind_dn())
 
     def test_is_anon(self):
         self.creds.set_username("")
@@ -72,14 +72,14 @@ class CredentialsTests(samba.tests.TestCase):
 
     def test_workstation(self):
         # FIXME: This is uninitialised, it should be None
-        #self.assertEquals(None, self.creds.get_workstation())
+        #self.assertEqual(None, self.creds.get_workstation())
         self.creds.set_workstation("myworksta")
-        self.assertEquals("myworksta", self.creds.get_workstation())
+        self.assertEqual("myworksta", self.creds.get_workstation())
 
     def test_get_nt_hash(self):
         self.creds.set_password("geheim")
-        self.assertEquals('\xc2\xae\x1f\xe6\xe6H\x84cRE>\x81o*\xeb\x93',
-                          self.creds.get_nt_hash())
+        self.assertEqual('\xc2\xae\x1f\xe6\xe6H\x84cRE>\x81o*\xeb\x93',
+                         self.creds.get_nt_hash())
 
     def test_guess(self):
         # Just check the method is there and doesn't raise an exception