summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_datasource/test_altcloud.py2
-rw-r--r--tests/unittests/test_datasource/test_azure.py2
-rw-r--r--tests/unittests/test_datasource/test_maas.py2
-rw-r--r--tests/unittests/test_datasource/test_opennebula.py4
-rw-r--r--tests/unittests/test_datasource/test_openstack.py4
-rw-r--r--tests/unittests/test_datasource/test_ovf.py2
-rw-r--r--tests/unittests/test_distros/test_resolv.py2
-rw-r--r--tests/unittests/test_handler/test_handler_power_state.py4
-rw-r--r--tests/unittests/test_handler/test_handler_snappy.py4
-rw-r--r--tests/unittests/test_helpers.py2
-rw-r--r--tests/unittests/test_net.py2
-rw-r--r--tests/unittests/test_util.py10
12 files changed, 20 insertions, 20 deletions
diff --git a/tests/unittests/test_datasource/test_altcloud.py b/tests/unittests/test_datasource/test_altcloud.py
index 63a2b04d..b6d4a453 100644
--- a/tests/unittests/test_datasource/test_altcloud.py
+++ b/tests/unittests/test_datasource/test_altcloud.py
@@ -419,7 +419,7 @@ class TestReadUserDataCallback(TestCase):
'''Test read_user_data_callback() no files are found.'''
_remove_user_data_files(self.mount_dir)
- self.assertEqual(None, dsac.read_user_data_callback(self.mount_dir))
+ self.assertIsNone(dsac.read_user_data_callback(self.mount_dir))
def force_arch(arch=None):
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 67cddeb9..852ec703 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -239,7 +239,7 @@ fdescfs /dev/fd fdescfs rw 0 0
with mock.patch.object(os.path, 'exists',
return_value=True):
res = get_path_dev_freebsd('/etc', mnt_list)
- self.assertNotEqual(res, None)
+ self.assertIsNotNone(res)
def test_basic_seed_dir(self):
odata = {'HostName': "myhost", 'UserName': "myuser"}
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index 693882d2..c1911bf4 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -44,7 +44,7 @@ class TestMAASDataSource(TestCase):
# verify that 'userdata' is not returned as part of the metadata
self.assertFalse(('user-data' in md))
- self.assertEqual(vd, None)
+ self.assertIsNone(vd)
def test_seed_dir_valid_extra(self):
"""Verify extra files do not affect seed_dir validity."""
diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py
index bce66125..b0f8e435 100644
--- a/tests/unittests/test_datasource/test_opennebula.py
+++ b/tests/unittests/test_datasource/test_opennebula.py
@@ -126,14 +126,14 @@ class TestOpenNebulaDataSource(TestCase):
populate_dir(self.seed_dir, {'context.sh': ''})
results = ds.read_context_disk_dir(self.seed_dir)
- self.assertEqual(results['userdata'], None)
+ self.assertIsNone(results['userdata'])
self.assertEqual(results['metadata'], {})
def test_seed_dir_empty2_context(self):
populate_context_dir(self.seed_dir, {})
results = ds.read_context_disk_dir(self.seed_dir)
- self.assertEqual(results['userdata'], None)
+ self.assertIsNone(results['userdata'])
self.assertEqual(results['metadata'], {})
def test_seed_dir_broken_context(self):
diff --git a/tests/unittests/test_datasource/test_openstack.py b/tests/unittests/test_datasource/test_openstack.py
index 7bf55084..c2905d1a 100644
--- a/tests/unittests/test_datasource/test_openstack.py
+++ b/tests/unittests/test_datasource/test_openstack.py
@@ -242,7 +242,7 @@ class TestOpenStackDataSource(test_helpers.HttprettyTestCase):
self.assertEqual(USER_DATA, ds_os.userdata_raw)
self.assertEqual(2, len(ds_os.files))
self.assertEqual(VENDOR_DATA, ds_os.vendordata_pure)
- self.assertEqual(ds_os.vendordata_raw, None)
+ self.assertIsNone(ds_os.vendordata_raw)
@hp.activate
def test_bad_datasource_meta(self):
@@ -318,7 +318,7 @@ class TestVendorDataLoading(test_helpers.TestCase):
self.assertEqual(self.cvj(data), data)
def test_vd_load_dict_no_ci(self):
- self.assertEqual(self.cvj({'foo': 'bar'}), None)
+ self.assertIsNone(self.cvj({'foo': 'bar'}))
def test_vd_load_dict_ci_dict(self):
self.assertRaises(ValueError, self.cvj,
diff --git a/tests/unittests/test_datasource/test_ovf.py b/tests/unittests/test_datasource/test_ovf.py
index 3e09510c..477cf8ed 100644
--- a/tests/unittests/test_datasource/test_ovf.py
+++ b/tests/unittests/test_datasource/test_ovf.py
@@ -68,6 +68,6 @@ class TestReadOvfEnv(test_helpers.TestCase):
md, ud, cfg = dsovf.read_ovf_environment(env)
self.assertEqual({"instance-id": "inst-001"}, md)
self.assertEqual({'password': "passw0rd"}, cfg)
- self.assertEqual(None, ud)
+ self.assertIsNone(ud)
# vi: ts=4 expandtab
diff --git a/tests/unittests/test_distros/test_resolv.py b/tests/unittests/test_distros/test_resolv.py
index c9d03475..97168cf9 100644
--- a/tests/unittests/test_distros/test_resolv.py
+++ b/tests/unittests/test_distros/test_resolv.py
@@ -30,7 +30,7 @@ class TestResolvHelper(TestCase):
def test_local_domain(self):
rp = resolv_conf.ResolvConf(BASE_RESOLVE)
- self.assertEqual(None, rp.local_domain)
+ self.assertIsNone(rp.local_domain)
rp.local_domain = "bob"
self.assertEqual('bob', rp.local_domain)
diff --git a/tests/unittests/test_handler/test_handler_power_state.py b/tests/unittests/test_handler/test_handler_power_state.py
index 3fd0069d..e382210d 100644
--- a/tests/unittests/test_handler/test_handler_power_state.py
+++ b/tests/unittests/test_handler/test_handler_power_state.py
@@ -15,12 +15,12 @@ class TestLoadPowerState(t_help.TestCase):
def test_no_config(self):
# completely empty config should mean do nothing
(cmd, _timeout, _condition) = psc.load_power_state({})
- self.assertEqual(cmd, None)
+ self.assertIsNone(cmd)
def test_irrelevant_config(self):
# no power_state field in config should return None for cmd
(cmd, _timeout, _condition) = psc.load_power_state({'foo': 'bar'})
- self.assertEqual(cmd, None)
+ self.assertIsNone(cmd)
def test_invalid_mode(self):
cfg = {'power_state': {'mode': 'gibberish'}}
diff --git a/tests/unittests/test_handler/test_handler_snappy.py b/tests/unittests/test_handler/test_handler_snappy.py
index edb73d6d..e4d07622 100644
--- a/tests/unittests/test_handler/test_handler_snappy.py
+++ b/tests/unittests/test_handler/test_handler_snappy.py
@@ -419,7 +419,7 @@ class TestSnapConfig(FilesystemMockingTestCase):
def test_snap_config_add_snap_user_no_config(self):
usercfg = add_snap_user(cfg=None)
- self.assertEqual(usercfg, None)
+ self.assertIsNone(usercfg)
def test_snap_config_add_snap_user_not_dict(self):
cfg = ['foobar']
@@ -428,7 +428,7 @@ class TestSnapConfig(FilesystemMockingTestCase):
def test_snap_config_add_snap_user_no_email(self):
cfg = {'assertions': [], 'known': True}
usercfg = add_snap_user(cfg=cfg)
- self.assertEqual(usercfg, None)
+ self.assertIsNone(usercfg)
@mock.patch('cloudinit.config.cc_snap_config.util')
def test_snap_config_add_snap_user_email_only(self, mock_util):
diff --git a/tests/unittests/test_helpers.py b/tests/unittests/test_helpers.py
index 955f8dfa..f1979e89 100644
--- a/tests/unittests/test_helpers.py
+++ b/tests/unittests/test_helpers.py
@@ -32,6 +32,6 @@ class TestPaths(test_helpers.ResourceUsingTestCase):
myds._instance_id = None
mypaths = self.getCloudPaths(myds)
- self.assertEqual(None, mypaths.get_ipath())
+ self.assertIsNone(mypaths.get_ipath())
# vi: ts=4 expandtab
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index feeab908..7104d00e 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -1301,7 +1301,7 @@ class TestCmdlineReadKernelConfig(CiTestCase):
files = sorted(populate_dir(self.tmp_dir(), content))
found = cmdline.read_kernel_cmdline_config(
files=files, cmdline='foo root=/dev/sda', mac_addrs=self.macs)
- self.assertEqual(found, None)
+ self.assertIsNone(found)
def test_ip_cmdline_both_ip_ip6(self):
content = {'net-eth0.conf': DHCP_CONTENT_1,
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index 490760d1..014aa6a3 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -44,7 +44,7 @@ class TestGetCfgOptionListOrStr(helpers.TestCase):
"""None is returned if key is not found and no default given."""
config = {}
result = util.get_cfg_option_list(config, "key")
- self.assertEqual(None, result)
+ self.assertIsNone(result)
def test_not_found_with_default(self):
"""Default is returned if key is not found."""
@@ -432,13 +432,13 @@ class TestReadDMIData(helpers.FilesystemMockingTestCase):
def test_none_returned_if_neither_source_has_data(self):
self.patch_mapping({})
self._configure_dmidecode_return('key', 'value')
- self.assertEqual(None, util.read_dmi_data('expect-fail'))
+ self.assertIsNone(util.read_dmi_data('expect-fail'))
def test_none_returned_if_dmidecode_not_in_path(self):
self.patched_funcs.enter_context(
mock.patch.object(util, 'which', lambda _: False))
self.patch_mapping({})
- self.assertEqual(None, util.read_dmi_data('expect-fail'))
+ self.assertIsNone(util.read_dmi_data('expect-fail'))
def test_dots_returned_instead_of_foxfox(self):
# uninitialized dmi values show as \xff, return those as .
@@ -626,8 +626,8 @@ class TestSubp(helpers.TestCase):
def test_returns_none_if_no_capture(self):
(out, err) = util.subp(self.stdin2out, data=b'', capture=False)
- self.assertEqual(err, None)
- self.assertEqual(out, None)
+ self.assertIsNone(err)
+ self.assertIsNone(out)
def test_bunch_of_slashes_in_path(self):
self.assertEqual("/target/my/path/",