summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/test_distros')
-rw-r--r--tests/unittests/test_distros/test_generic.py10
-rw-r--r--tests/unittests/test_distros/test_hostname.py12
-rw-r--r--tests/unittests/test_distros/test_hosts.py18
-rw-r--r--tests/unittests/test_distros/test_netconfig.py37
-rw-r--r--tests/unittests/test_distros/test_resolv.py21
-rw-r--r--tests/unittests/test_distros/test_sysconfig.py27
-rw-r--r--tests/unittests/test_distros/test_user_data_normalize.py74
7 files changed, 98 insertions, 101 deletions
diff --git a/tests/unittests/test_distros/test_generic.py b/tests/unittests/test_distros/test_generic.py
index 6ed1704c..96fa0811 100644
--- a/tests/unittests/test_distros/test_generic.py
+++ b/tests/unittests/test_distros/test_generic.py
@@ -87,13 +87,13 @@ class TestGenericDistro(helpers.FilesystemMockingTestCase):
rules = 'ALL=(ALL:ALL) ALL'
contents = self._write_load_sudoers('harlowja', rules)
expected = ['harlowja ALL=(ALL:ALL) ALL']
- self.assertEquals(len(expected), self._count_in(expected, contents))
+ self.assertEqual(len(expected), self._count_in(expected, contents))
not_expected = [
'harlowja A',
'harlowja L',
'harlowja L',
]
- self.assertEquals(0, self._count_in(not_expected, contents))
+ self.assertEqual(0, self._count_in(not_expected, contents))
def test_sudoers_ensure_rules_list(self):
rules = [
@@ -107,13 +107,13 @@ class TestGenericDistro(helpers.FilesystemMockingTestCase):
'harlowja B-ALL=(ALL:ALL) ALL',
'harlowja C-ALL=(ALL:ALL) ALL',
]
- self.assertEquals(len(expected), self._count_in(expected, contents))
+ self.assertEqual(len(expected), self._count_in(expected, contents))
not_expected = [
'harlowja A',
'harlowja L',
'harlowja L',
]
- self.assertEquals(0, self._count_in(not_expected, contents))
+ self.assertEqual(0, self._count_in(not_expected, contents))
def test_sudoers_ensure_new(self):
cls = distros.fetch("ubuntu")
@@ -136,7 +136,7 @@ class TestGenericDistro(helpers.FilesystemMockingTestCase):
self.assertIn("includedir /b", contents)
self.assertTrue(os.path.isdir("/b"))
self.assertIn("josh", contents)
- self.assertEquals(2, contents.count("josh"))
+ self.assertEqual(2, contents.count("josh"))
def test_arch_package_mirror_info_unknown(self):
"""for an unknown arch, we should get back that with arch 'default'."""
diff --git a/tests/unittests/test_distros/test_hostname.py b/tests/unittests/test_distros/test_hostname.py
index 143e29a9..5f28a868 100644
--- a/tests/unittests/test_distros/test_hostname.py
+++ b/tests/unittests/test_distros/test_hostname.py
@@ -15,24 +15,24 @@ BASE_HOSTNAME = BASE_HOSTNAME.strip()
class TestHostnameHelper(unittest.TestCase):
def test_parse_same(self):
hn = hostname.HostnameConf(BASE_HOSTNAME)
- self.assertEquals(str(hn).strip(), BASE_HOSTNAME)
- self.assertEquals(hn.hostname, 'blahblah')
+ self.assertEqual(str(hn).strip(), BASE_HOSTNAME)
+ self.assertEqual(hn.hostname, 'blahblah')
def test_no_adjust_hostname(self):
hn = hostname.HostnameConf(BASE_HOSTNAME)
prev_name = hn.hostname
hn.set_hostname("")
- self.assertEquals(hn.hostname, prev_name)
+ self.assertEqual(hn.hostname, prev_name)
def test_adjust_hostname(self):
hn = hostname.HostnameConf(BASE_HOSTNAME)
prev_name = hn.hostname
- self.assertEquals(prev_name, 'blahblah')
+ self.assertEqual(prev_name, 'blahblah')
hn.set_hostname("bbbbd")
- self.assertEquals(hn.hostname, 'bbbbd')
+ self.assertEqual(hn.hostname, 'bbbbd')
expected_out = '''
# My super-duper-hostname
bbbbd
'''
- self.assertEquals(str(hn).strip(), expected_out.strip())
+ self.assertEqual(str(hn).strip(), expected_out.strip())
diff --git a/tests/unittests/test_distros/test_hosts.py b/tests/unittests/test_distros/test_hosts.py
index fc701eaa..ab867c6f 100644
--- a/tests/unittests/test_distros/test_hosts.py
+++ b/tests/unittests/test_distros/test_hosts.py
@@ -17,25 +17,25 @@ BASE_ETC = BASE_ETC.strip()
class TestHostsHelper(unittest.TestCase):
def test_parse(self):
eh = hosts.HostsConf(BASE_ETC)
- self.assertEquals(eh.get_entry('127.0.0.1'), [['localhost']])
- self.assertEquals(eh.get_entry('192.168.1.10'),
- [['foo.mydomain.org', 'foo'],
- ['bar.mydomain.org', 'bar']])
+ self.assertEqual(eh.get_entry('127.0.0.1'), [['localhost']])
+ self.assertEqual(eh.get_entry('192.168.1.10'),
+ [['foo.mydomain.org', 'foo'],
+ ['bar.mydomain.org', 'bar']])
eh = str(eh)
self.assertTrue(eh.startswith('# Example'))
def test_add(self):
eh = hosts.HostsConf(BASE_ETC)
eh.add_entry('127.0.0.0', 'blah')
- self.assertEquals(eh.get_entry('127.0.0.0'), [['blah']])
+ self.assertEqual(eh.get_entry('127.0.0.0'), [['blah']])
eh.add_entry('127.0.0.3', 'blah', 'blah2', 'blah3')
- self.assertEquals(eh.get_entry('127.0.0.3'),
- [['blah', 'blah2', 'blah3']])
+ self.assertEqual(eh.get_entry('127.0.0.3'),
+ [['blah', 'blah2', 'blah3']])
def test_del(self):
eh = hosts.HostsConf(BASE_ETC)
eh.add_entry('127.0.0.0', 'blah')
- self.assertEquals(eh.get_entry('127.0.0.0'), [['blah']])
+ self.assertEqual(eh.get_entry('127.0.0.0'), [['blah']])
eh.del_entries('127.0.0.0')
- self.assertEquals(eh.get_entry('127.0.0.0'), [])
+ self.assertEqual(eh.get_entry('127.0.0.0'), [])
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
index 2c2a424d..9172e3aa 100644
--- a/tests/unittests/test_distros/test_netconfig.py
+++ b/tests/unittests/test_distros/test_netconfig.py
@@ -1,4 +1,5 @@
import os
+from six import StringIO
try:
from unittest import mock
@@ -9,16 +10,14 @@ try:
except ImportError:
from contextlib2 import ExitStack
-from six import StringIO
from ..helpers import TestCase
from cloudinit import distros
+from cloudinit.distros.parsers.sys_conf import SysConf
from cloudinit import helpers
from cloudinit import settings
from cloudinit import util
-from cloudinit.distros.parsers.sys_conf import SysConf
-
BASE_NET_CFG = '''
auto lo
@@ -108,23 +107,23 @@ class TestNetCfgDistro(TestCase):
ub_distro.apply_network(BASE_NET_CFG, False)
- self.assertEquals(len(write_bufs), 1)
+ self.assertEqual(len(write_bufs), 1)
eni_name = '/etc/network/interfaces.d/50-cloud-init.cfg'
self.assertIn(eni_name, write_bufs)
write_buf = write_bufs[eni_name]
- self.assertEquals(str(write_buf).strip(), BASE_NET_CFG.strip())
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(str(write_buf).strip(), BASE_NET_CFG.strip())
+ self.assertEqual(write_buf.mode, 0o644)
def assertCfgEquals(self, blob1, blob2):
b1 = dict(SysConf(blob1.strip().splitlines()))
b2 = dict(SysConf(blob2.strip().splitlines()))
- self.assertEquals(b1, b2)
+ self.assertEqual(b1, b2)
for (k, v) in b1.items():
self.assertIn(k, b2)
for (k, v) in b2.items():
self.assertIn(k, b1)
for (k, v) in b1.items():
- self.assertEquals(v, b2[k])
+ self.assertEqual(v, b2[k])
def test_simple_write_rh(self):
rh_distro = self._get_distro('rhel')
@@ -148,7 +147,7 @@ class TestNetCfgDistro(TestCase):
rh_distro.apply_network(BASE_NET_CFG, False)
- self.assertEquals(len(write_bufs), 4)
+ self.assertEqual(len(write_bufs), 4)
self.assertIn('/etc/sysconfig/network-scripts/ifcfg-lo',
write_bufs)
write_buf = write_bufs['/etc/sysconfig/network-scripts/ifcfg-lo']
@@ -157,7 +156,7 @@ DEVICE="lo"
ONBOOT=yes
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
self.assertIn('/etc/sysconfig/network-scripts/ifcfg-eth0',
write_bufs)
@@ -172,7 +171,7 @@ GATEWAY="192.168.1.254"
BROADCAST="192.168.1.0"
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
self.assertIn('/etc/sysconfig/network-scripts/ifcfg-eth1',
write_bufs)
@@ -183,7 +182,7 @@ BOOTPROTO="dhcp"
ONBOOT=yes
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
self.assertIn('/etc/sysconfig/network', write_bufs)
write_buf = write_bufs['/etc/sysconfig/network']
@@ -192,7 +191,7 @@ ONBOOT=yes
NETWORKING=yes
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
def test_write_ipv6_rhel(self):
rh_distro = self._get_distro('rhel')
@@ -216,7 +215,7 @@ NETWORKING=yes
rh_distro.apply_network(BASE_NET_CFG_IPV6, False)
- self.assertEquals(len(write_bufs), 4)
+ self.assertEqual(len(write_bufs), 4)
self.assertIn('/etc/sysconfig/network-scripts/ifcfg-lo',
write_bufs)
write_buf = write_bufs['/etc/sysconfig/network-scripts/ifcfg-lo']
@@ -225,7 +224,7 @@ DEVICE="lo"
ONBOOT=yes
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
self.assertIn('/etc/sysconfig/network-scripts/ifcfg-eth0',
write_bufs)
@@ -243,7 +242,7 @@ IPV6ADDR="2607:f0d0:1002:0011::2"
IPV6_DEFAULTGW="2607:f0d0:1002:0011::1"
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
self.assertIn('/etc/sysconfig/network-scripts/ifcfg-eth1',
write_bufs)
write_buf = write_bufs['/etc/sysconfig/network-scripts/ifcfg-eth1']
@@ -260,7 +259,7 @@ IPV6ADDR="2607:f0d0:1002:0011::3"
IPV6_DEFAULTGW="2607:f0d0:1002:0011::1"
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
self.assertIn('/etc/sysconfig/network', write_bufs)
write_buf = write_bufs['/etc/sysconfig/network']
@@ -271,7 +270,7 @@ NETWORKING_IPV6=yes
IPV6_AUTOCONF=no
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
def test_simple_write_freebsd(self):
fbsd_distro = self._get_distro('freebsd')
@@ -319,4 +318,4 @@ ifconfig_vtnet1="DHCP"
defaultrouter="192.168.1.254"
'''
self.assertCfgEquals(expected_buf, str(write_buf))
- self.assertEquals(write_buf.mode, 0o644)
+ self.assertEqual(write_buf.mode, 0o644)
diff --git a/tests/unittests/test_distros/test_resolv.py b/tests/unittests/test_distros/test_resolv.py
index 9edeb6e7..9402b5ea 100644
--- a/tests/unittests/test_distros/test_resolv.py
+++ b/tests/unittests/test_distros/test_resolv.py
@@ -1,9 +1,10 @@
from cloudinit.distros.parsers import resolv_conf
from cloudinit.distros import rhel_util
+from ..helpers import TestCase
+
import re
import tempfile
-from ..helpers import TestCase
BASE_RESOLVE = '''
@@ -19,7 +20,7 @@ class TestResolvHelper(TestCase):
def test_parse_same(self):
rp = resolv_conf.ResolvConf(BASE_RESOLVE)
rp_r = str(rp).strip()
- self.assertEquals(BASE_RESOLVE, rp_r)
+ self.assertEqual(BASE_RESOLVE, rp_r)
def test_write_works(self):
with tempfile.NamedTemporaryFile() as fh:
@@ -27,10 +28,10 @@ class TestResolvHelper(TestCase):
def test_local_domain(self):
rp = resolv_conf.ResolvConf(BASE_RESOLVE)
- self.assertEquals(None, rp.local_domain)
+ self.assertEqual(None, rp.local_domain)
rp.local_domain = "bob"
- self.assertEquals('bob', rp.local_domain)
+ self.assertEqual('bob', rp.local_domain)
self.assertIn('domain bob', str(rp))
def test_nameservers(self):
@@ -41,7 +42,7 @@ class TestResolvHelper(TestCase):
self.assertIn('10.2', rp.nameservers)
self.assertIn('nameserver 10.2', str(rp))
self.assertNotIn('10.3', rp.nameservers)
- self.assertEquals(len(rp.nameservers), 3)
+ self.assertEqual(len(rp.nameservers), 3)
rp.add_nameserver('10.2')
self.assertRaises(ValueError, rp.add_nameserver, '10.3')
self.assertNotIn('10.3', rp.nameservers)
@@ -55,12 +56,12 @@ class TestResolvHelper(TestCase):
self.assertTrue(re.search(r'search(.*)bbb.y.com(.*)', str(rp)))
self.assertIn('bbb.y.com', rp.search_domains)
rp.add_search_domain('bbb.y.com')
- self.assertEquals(len(rp.search_domains), 3)
+ self.assertEqual(len(rp.search_domains), 3)
rp.add_search_domain('bbb2.y.com')
- self.assertEquals(len(rp.search_domains), 4)
+ self.assertEqual(len(rp.search_domains), 4)
rp.add_search_domain('bbb3.y.com')
- self.assertEquals(len(rp.search_domains), 5)
+ self.assertEqual(len(rp.search_domains), 5)
rp.add_search_domain('bbb4.y.com')
- self.assertEquals(len(rp.search_domains), 6)
+ self.assertEqual(len(rp.search_domains), 6)
self.assertRaises(ValueError, rp.add_search_domain, 'bbb5.y.com')
- self.assertEquals(len(rp.search_domains), 6)
+ self.assertEqual(len(rp.search_domains), 6)
diff --git a/tests/unittests/test_distros/test_sysconfig.py b/tests/unittests/test_distros/test_sysconfig.py
index 03d89a10..8cb55522 100644
--- a/tests/unittests/test_distros/test_sysconfig.py
+++ b/tests/unittests/test_distros/test_sysconfig.py
@@ -1,6 +1,7 @@
import re
from cloudinit.distros.parsers.sys_conf import SysConf
+
from ..helpers import TestCase
@@ -27,34 +28,34 @@ IPV6TO4_ROUTING='eth0-:0004::1/64 eth1-:0005::1/64'
ETHTOOL_OPTS="-K ${DEVICE} tso on; -G ${DEVICE} rx 256 tx 256"
USEMD5=no'''
conf = SysConf(contents.splitlines())
- self.assertEquals(conf['HOSTNAME'], 'blahblah')
- self.assertEquals(conf['SHORTDATE'], '$(date +%y:%m:%d:%H:%M)')
+ self.assertEqual(conf['HOSTNAME'], 'blahblah')
+ self.assertEqual(conf['SHORTDATE'], '$(date +%y:%m:%d:%H:%M)')
# Should be unquoted
- self.assertEquals(conf['ETHTOOL_OPTS'], ('-K ${DEVICE} tso on; '
- '-G ${DEVICE} rx 256 tx 256'))
- self.assertEquals(contents, str(conf))
+ self.assertEqual(conf['ETHTOOL_OPTS'], ('-K ${DEVICE} tso on; '
+ '-G ${DEVICE} rx 256 tx 256'))
+ self.assertEqual(contents, str(conf))
def test_parse_shell_vars(self):
contents = 'USESMBAUTH=$XYZ'
conf = SysConf(contents.splitlines())
- self.assertEquals(contents, str(conf))
+ self.assertEqual(contents, str(conf))
conf = SysConf('')
conf['B'] = '${ZZ}d apples'
# Should be quoted
- self.assertEquals('B="${ZZ}d apples"', str(conf))
+ self.assertEqual('B="${ZZ}d apples"', str(conf))
conf = SysConf('')
conf['B'] = '$? d apples'
- self.assertEquals('B="$? d apples"', str(conf))
+ self.assertEqual('B="$? d apples"', str(conf))
contents = 'IPMI_WATCHDOG_OPTIONS="timeout=60"'
conf = SysConf(contents.splitlines())
- self.assertEquals('IPMI_WATCHDOG_OPTIONS=timeout=60', str(conf))
+ self.assertEqual('IPMI_WATCHDOG_OPTIONS=timeout=60', str(conf))
def test_parse_adjust(self):
contents = 'IPV6TO4_ROUTING="eth0-:0004::1/64 eth1-:0005::1/64"'
conf = SysConf(contents.splitlines())
# Should be unquoted
- self.assertEquals('eth0-:0004::1/64 eth1-:0005::1/64',
- conf['IPV6TO4_ROUTING'])
+ self.assertEqual('eth0-:0004::1/64 eth1-:0005::1/64',
+ conf['IPV6TO4_ROUTING'])
conf['IPV6TO4_ROUTING'] = "blah \tblah"
contents2 = str(conf).strip()
# Should be requoted due to whitespace
@@ -65,12 +66,12 @@ USEMD5=no'''
conf = SysConf(''.splitlines())
conf['B'] = ' $(time)'
contents = str(conf)
- self.assertEquals('B= $(time)', contents)
+ self.assertEqual('B= $(time)', contents)
def test_parse_empty(self):
contents = ''
conf = SysConf(contents.splitlines())
- self.assertEquals('', str(conf).strip())
+ self.assertEqual('', str(conf).strip())
def test_parse_add_new(self):
contents = 'BLAH=b'
diff --git a/tests/unittests/test_distros/test_user_data_normalize.py b/tests/unittests/test_distros/test_user_data_normalize.py
index 4525f487..a887a930 100644
--- a/tests/unittests/test_distros/test_user_data_normalize.py
+++ b/tests/unittests/test_distros/test_user_data_normalize.py
@@ -33,20 +33,19 @@ class TestUGNormalize(TestCase):
def test_group_dict(self):
distro = self._make_distro('ubuntu')
- g = {'groups': [
- {'ubuntu': ['foo', 'bar'],
- 'bob': 'users'},
- 'cloud-users',
- {'bob': 'users2'}
- ]}
+ g = {'groups':
+ [{'ubuntu': ['foo', 'bar'],
+ 'bob': 'users'},
+ 'cloud-users',
+ {'bob': 'users2'}]}
(_users, groups) = self._norm(g, distro)
self.assertIn('ubuntu', groups)
ub_members = groups['ubuntu']
- self.assertEquals(sorted(['foo', 'bar']), sorted(ub_members))
+ self.assertEqual(sorted(['foo', 'bar']), sorted(ub_members))
self.assertIn('bob', groups)
b_members = groups['bob']
- self.assertEquals(sorted(['users', 'users2']),
- sorted(b_members))
+ self.assertEqual(sorted(['users', 'users2']),
+ sorted(b_members))
def test_basic_groups(self):
distro = self._make_distro('ubuntu')
@@ -55,7 +54,7 @@ class TestUGNormalize(TestCase):
}
(users, groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_csv_groups(self):
distro = self._make_distro('ubuntu')
@@ -66,7 +65,7 @@ class TestUGNormalize(TestCase):
self.assertIn('bob', groups)
self.assertIn('joe', groups)
self.assertIn('steve', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_more_groups(self):
distro = self._make_distro('ubuntu')
@@ -77,7 +76,7 @@ class TestUGNormalize(TestCase):
self.assertIn('bob', groups)
self.assertIn('joe', groups)
self.assertIn('steve', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_member_groups(self):
distro = self._make_distro('ubuntu')
@@ -90,11 +89,11 @@ class TestUGNormalize(TestCase):
}
(users, groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', groups)
- self.assertEquals(['s'], groups['bob'])
- self.assertEquals([], groups['joe'])
+ self.assertEqual(['s'], groups['bob'])
+ self.assertEqual([], groups['joe'])
self.assertIn('joe', groups)
self.assertIn('steve', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_users_simple_dict(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -128,14 +127,14 @@ class TestUGNormalize(TestCase):
}
}
(users, _groups) = self._norm(ug_cfg, distro)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
ug_cfg = {
'users': {
'default': 'no',
}
}
(users, _groups) = self._norm(ug_cfg, distro)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_users_simple_csv(self):
distro = self._make_distro('ubuntu')
@@ -145,8 +144,8 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])
def test_users_simple(self):
distro = self._make_distro('ubuntu')
@@ -159,8 +158,8 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])
def test_users_old_user(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -211,8 +210,8 @@ class TestUGNormalize(TestCase):
self.assertIn('zetta', users)
ug_cfg = {}
(users, groups) = self._norm(ug_cfg, distro)
- self.assertEquals({}, users)
- self.assertEquals({}, groups)
+ self.assertEqual({}, users)
+ self.assertEqual({}, groups)
def test_users_dict_default_additional(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -223,12 +222,10 @@ class TestUGNormalize(TestCase):
}
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', users)
- self.assertEquals(",".join(distro.get_default_user()['groups']),
- users['bob']['groups'])
- self.assertEquals(True,
- users['bob']['blah'])
- self.assertEquals(True,
- users['bob']['default'])
+ self.assertEqual(",".join(distro.get_default_user()['groups']),
+ users['bob']['groups'])
+ self.assertEqual(True, users['bob']['blah'])
+ self.assertEqual(True, users['bob']['default'])
def test_users_dict_extract(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -240,7 +237,7 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', users)
(name, config) = distros.extract_default(users)
- self.assertEquals(name, 'bob')
+ self.assertEqual(name, 'bob')
expected_config = {}
def_config = None
try:
@@ -255,7 +252,7 @@ class TestUGNormalize(TestCase):
expected_config.pop('name', None)
expected_config.pop('groups', None)
config.pop('groups', None)
- self.assertEquals(config, expected_config)
+ self.assertEqual(config, expected_config)
def test_users_dict_default(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -266,10 +263,9 @@ class TestUGNormalize(TestCase):
}
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', users)
- self.assertEquals(",".join(distro.get_default_user()['groups']),
- users['bob']['groups'])
- self.assertEquals(True,
- users['bob']['default'])
+ self.assertEqual(",".join(distro.get_default_user()['groups']),
+ users['bob']['groups'])
+ self.assertEqual(True, users['bob']['default'])
def test_users_dict_trans(self):
distro = self._make_distro('ubuntu')
@@ -283,8 +279,8 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'tr_me': True, 'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'tr_me': True, 'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])
def test_users_dict(self):
distro = self._make_distro('ubuntu')
@@ -297,5 +293,5 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])