summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_digitalocean.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-12-06 16:30:22 -0600
committerScott Moser <smoser@brickies.net>2017-12-07 22:40:07 -0500
commita110e483e8644ab73e69853ea11b6c4c6cfa04b6 (patch)
tree455267ae3a8b69d0d6d93c142160422925ba04ec /tests/unittests/test_datasource/test_digitalocean.py
parent0cf6db3617e0cebeb89c4809396f84360827e96c (diff)
downloadvyos-cloud-init-a110e483e8644ab73e69853ea11b6c4c6cfa04b6.tar.gz
vyos-cloud-init-a110e483e8644ab73e69853ea11b6c4c6cfa04b6.zip
pylint: Update pylint to 1.7.1, run on tests/ and tools and fix complaints.
The motivation for this is that a.) 1.7.1 runs with python 3.6 (bionic) b.) we want to run pylint on tests/ and tools for the same reasons that we want to run it on cloudinit/ The changes are described below. - Update tox.ini to invoke pylint v1.7.1. - Modify .pylintrc generated-members ignore mocked object members (m_.*) - Replace "dangerous" params defaulting to {} - Fix up cloud_tests use of platforms - Cast some instance objects to with dict() - Handle python2.7 vs 3+ ConfigParser use of readfp (deprecated) - Update use of assertEqual(<boolean>, value) to assert<Boolean>(value) - replace depricated assertRegexp -> assertRegex - Remove useless test-class calls to super class - Assign class property accessors a result and use it - Fix missing class member in CepkoResultTests - Fix Cheetah test import
Diffstat (limited to 'tests/unittests/test_datasource/test_digitalocean.py')
-rw-r--r--tests/unittests/test_datasource/test_digitalocean.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/unittests/test_datasource/test_digitalocean.py b/tests/unittests/test_datasource/test_digitalocean.py
index ec321733..3127014b 100644
--- a/tests/unittests/test_datasource/test_digitalocean.py
+++ b/tests/unittests/test_datasource/test_digitalocean.py
@@ -199,9 +199,8 @@ class TestDataSourceDigitalOcean(CiTestCase):
class TestNetworkConvert(CiTestCase):
- @mock.patch('cloudinit.net.get_interfaces_by_mac')
- def _get_networking(self, m_get_by_mac):
- m_get_by_mac.return_value = {
+ def _get_networking(self):
+ self.m_get_by_mac.return_value = {
'04:01:57:d1:9e:01': 'ens1',
'04:01:57:d1:9e:02': 'ens2',
'b8:ae:ed:75:5f:9a': 'enp0s25',
@@ -211,6 +210,10 @@ class TestNetworkConvert(CiTestCase):
self.assertIn('config', netcfg)
return netcfg
+ def setUp(self):
+ super(TestNetworkConvert, self).setUp()
+ self.add_patch('cloudinit.net.get_interfaces_by_mac', 'm_get_by_mac')
+
def test_networking_defined(self):
netcfg = self._get_networking()
self.assertIsNotNone(netcfg)