summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_digitalocean.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2016-10-04 09:56:10 -0500
committerScott Moser <smoser@brickies.net>2016-10-04 16:35:56 -0400
commit760a4f1852ee7241c00804ebf210b6a4b1e9063d (patch)
tree51bd767f52434487f628a1f43a847f98c57a1fa9 /tests/unittests/test_datasource/test_digitalocean.py
parent1071b9940b4e114cd2eabf290b739f92fbab33de (diff)
downloadvyos-cloud-init-760a4f1852ee7241c00804ebf210b6a4b1e9063d.tar.gz
vyos-cloud-init-760a4f1852ee7241c00804ebf210b6a4b1e9063d.zip
unittests: fix use of mock 2.0 'assert_called' when running make check
Some of the new DigitalOcean unittests were written to use 'assert_called', which is only available in mock versions 2.0. Because of this, the failure would only occur in releases less than yakkety and not in 'tox'. Add a 'xenial' entry to tox.ini with versions from xenial.
Diffstat (limited to 'tests/unittests/test_datasource/test_digitalocean.py')
-rw-r--r--tests/unittests/test_datasource/test_digitalocean.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unittests/test_datasource/test_digitalocean.py b/tests/unittests/test_datasource/test_digitalocean.py
index bdfe0ba2..7bde0820 100644
--- a/tests/unittests/test_datasource/test_digitalocean.py
+++ b/tests/unittests/test_datasource/test_digitalocean.py
@@ -162,7 +162,7 @@ class TestDataSourceDigitalOcean(TestCase):
m_read_sysinfo.return_value = (False, None)
ds = self.get_ds(get_sysinfo=None)
self.assertEqual(False, ds.get_data())
- m_read_sysinfo.assert_called()
+ self.assertTrue(m_read_sysinfo.called)
@mock.patch('cloudinit.sources.helpers.digitalocean.read_metadata')
def test_metadata(self, mock_readmd):
@@ -172,7 +172,7 @@ class TestDataSourceDigitalOcean(TestCase):
ret = ds.get_data()
self.assertTrue(ret)
- mock_readmd.assert_called()
+ self.assertTrue(mock_readmd.called)
self.assertEqual(DO_META.get('user_data'), ds.get_userdata_raw())
self.assertEqual(DO_META.get('vendor_data'), ds.get_vendordata_raw())
@@ -196,7 +196,7 @@ class TestDataSourceDigitalOcean(TestCase):
ret = ds.get_data()
self.assertTrue(ret)
- mock_readmd.assert_called()
+ self.assertTrue(mock_readmd.called)
# Multiple keys
self.assertEqual(metadata['public_keys'], ds.get_public_ssh_keys())