summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVlastimil Holer <vlastimil.holer@gmail.com>2013-09-04 14:32:24 +0200
committerVlastimil Holer <vlastimil.holer@gmail.com>2013-09-04 14:32:24 +0200
commit77c8798388637fcb2f7dbc057cad81e8fd5fbe58 (patch)
tree52ebf360fec192392042be7abfbf70d659a41b10 /tests
parent1d35141960f2c0183d3f306d4604011ca9d5d2e8 (diff)
downloadvyos-cloud-init-77c8798388637fcb2f7dbc057cad81e8fd5fbe58.tar.gz
vyos-cloud-init-77c8798388637fcb2f7dbc057cad81e8fd5fbe58.zip
Apply parse.diff by Javier Fontan <jfontan@opennebula.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/helpers.py1
-rw-r--r--tests/unittests/test_datasource/test_opennebula.py16
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py
index 91a50e18..904677f1 100644
--- a/tests/unittests/helpers.py
+++ b/tests/unittests/helpers.py
@@ -183,6 +183,7 @@ class FilesystemMockingTestCase(ResourceUsingTestCase):
setattr(mod, f, trap_func)
self.patched_funcs.append((mod, f, func))
+
def populate_dir(path, files):
os.makedirs(path)
for (name, content) in files.iteritems():
diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py
index bc6c4b73..27725930 100644
--- a/tests/unittests/test_datasource/test_opennebula.py
+++ b/tests/unittests/test_datasource/test_opennebula.py
@@ -19,9 +19,11 @@ SSH_KEY = 'ssh-rsa AAAAB3NzaC1....sIkJhq8wdX+4I3A4cYbYP ubuntu@server-460-%i'
HOSTNAME = 'foo.example.com'
PUBLIC_IP = '10.0.0.3'
-CMD_IP_OUT = '''\
-1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN \ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
-2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000\ link/ether 02:00:0a:12:01:01 brd ff:ff:ff:ff:ff:ff
+CMD_IP_OUT = '''
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
+ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
+ link/ether 02:00:0a:12:01:01 brd ff:ff:ff:ff:ff:ff
'''
@@ -52,7 +54,7 @@ class TestOpenNebulaDataSource(MockerTestCase):
self.assertEqual(TEST_VARS, results['metadata'])
def test_ssh_key(self):
- public_keys = []
+ public_keys = ['first key', 'second key']
for c in range(4):
for k in ('SSH_KEY', 'SSH_PUBLIC_KEY'):
my_d = os.path.join(self.tmp, "%s-%i" % (k, c))
@@ -61,7 +63,8 @@ class TestOpenNebulaDataSource(MockerTestCase):
self.assertTrue('metadata' in results)
self.assertTrue('public-keys' in results['metadata'])
- self.assertEqual(public_keys, results['metadata']['public-keys'])
+ self.assertEqual(public_keys,
+ results['metadata']['public-keys'])
public_keys.append(SSH_KEY % (c + 1,))
@@ -96,7 +99,8 @@ class TestOpenNebulaDataSource(MockerTestCase):
try:
orig_find_devs_with = util.find_devs_with
util.find_devs_with = my_devs_with
- self.assertEqual(["/dev/sr0", "/dev/vdb"], ds.find_candidate_devs())
+ self.assertEqual(["/dev/sr0", "/dev/vdb"],
+ ds.find_candidate_devs())
finally:
util.find_devs_with = orig_find_devs_with