summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-03-07 16:47:54 -0500
committerScott Moser <smoser@ubuntu.com>2013-03-07 16:47:54 -0500
commitaae7fe638f61aaf02c6579d5b691a8641455c875 (patch)
treeee449987b9076806975802e3843f0305736c3f1b /tests
parent9a771ec66f4e79bcd30f7cad7ef4b67e9cc7512d (diff)
downloadvyos-cloud-init-aae7fe638f61aaf02c6579d5b691a8641455c875.tar.gz
vyos-cloud-init-aae7fe638f61aaf02c6579d5b691a8641455c875.zip
fix pep8 and pylint
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test__init__.py2
-rw-r--r--tests/unittests/test_merging.py8
-rw-r--r--tests/unittests/test_userdata.py39
3 files changed, 26 insertions, 23 deletions
diff --git a/tests/unittests/test__init__.py b/tests/unittests/test__init__.py
index 7924755a..56ccbcfb 100644
--- a/tests/unittests/test__init__.py
+++ b/tests/unittests/test__init__.py
@@ -24,8 +24,6 @@ class FakeModule(handlers.Handler):
def handle_part(self, data, ctype, filename, payload, frequency):
pass
-
-
class TestWalkerHandleHandler(MockerTestCase):
diff --git a/tests/unittests/test_merging.py b/tests/unittests/test_merging.py
index fa7ee8e4..591a99c8 100644
--- a/tests/unittests/test_merging.py
+++ b/tests/unittests/test_merging.py
@@ -1,5 +1,3 @@
-import os
-
from tests.unittests import helpers
from cloudinit import mergers
@@ -107,8 +105,10 @@ class TestSimpleRun(helpers.MockerTestCase):
self.assertEquals(merged['a'], [1, 'b', 2, 'e', 'f', 'g'])
self.assertEquals(merged['b'], 'blahblahmore')
self.assertEquals(merged['c']['f'], 'bigblobofstuff')
- self.assertEquals(merged['run'], ['runme', 'runme2', 'morecmd', 'moremoremore'])
- self.assertEquals(merged['runmereally'], ['e', ['a'], 'd', 'blah', ['b'], 'e'])
+ self.assertEquals(merged['run'], ['runme', 'runme2', 'morecmd',
+ 'moremoremore'])
+ self.assertEquals(merged['runmereally'], ['e', ['a'], 'd', 'blah',
+ ['b'], 'e'])
def test_dict_overwrite_layered(self):
source = {
diff --git a/tests/unittests/test_userdata.py b/tests/unittests/test_userdata.py
index ef0dd7b8..48ad9c5f 100644
--- a/tests/unittests/test_userdata.py
+++ b/tests/unittests/test_userdata.py
@@ -7,8 +7,6 @@ import os
from email.mime.base import MIMEBase
-from mocker import MockerTestCase
-
from cloudinit import handlers
from cloudinit import helpers as c_helpers
from cloudinit import log
@@ -97,14 +95,16 @@ p: 1
new_root = self.makeDir()
self.patchUtils(new_root)
self.patchOS(new_root)
- cloud_cfg.handle_part(None, handlers.CONTENT_START, None, None, None, None)
+ cloud_cfg.handle_part(None, handlers.CONTENT_START, None, None, None,
+ None)
for i, m in enumerate(messages):
headers = dict(m)
fn = "part-%s" % (i + 1)
payload = m.get_payload(decode=True)
cloud_cfg.handle_part(None, headers['Content-Type'],
fn, payload, None, headers)
- cloud_cfg.handle_part(None, handlers.CONTENT_END, None, None, None, None)
+ cloud_cfg.handle_part(None, handlers.CONTENT_END, None, None, None,
+ None)
contents = util.load_file(paths.get_ipath('cloud_config'))
contents = util.load_yaml(contents)
self.assertEquals(contents['run'], ['b', 'c', 'stuff', 'morestuff'])
@@ -118,8 +118,9 @@ p: 1
data = "arbitrary text\n"
ci.datasource = FakeDataSource(data)
- self.mock_write = self.mocker.replace("cloudinit.util.write_file", passthrough=False)
- self.mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
+ mock_write = self.mocker.replace("cloudinit.util.write_file",
+ passthrough=False)
+ mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
self.mocker.replay()
log_file = self.capture_log(logging.WARNING)
@@ -136,8 +137,9 @@ p: 1
message.set_payload("Just text")
ci.datasource = FakeDataSource(message.as_string())
- self.mock_write = self.mocker.replace("cloudinit.util.write_file", passthrough=False)
- self.mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
+ mock_write = self.mocker.replace("cloudinit.util.write_file",
+ passthrough=False)
+ mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
self.mocker.replay()
log_file = self.capture_log(logging.WARNING)
@@ -154,9 +156,10 @@ p: 1
ci.datasource = FakeDataSource(script)
outpath = os.path.join(ci.paths.get_ipath_cur("scripts"), "part-001")
- self.mock_write = self.mocker.replace("cloudinit.util.write_file", passthrough=False)
- self.mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
- self.mock_write(outpath, script, 0700)
+ mock_write = self.mocker.replace("cloudinit.util.write_file",
+ passthrough=False)
+ mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
+ mock_write(outpath, script, 0700)
self.mocker.replay()
log_file = self.capture_log(logging.WARNING)
@@ -173,9 +176,10 @@ p: 1
ci.datasource = FakeDataSource(message.as_string())
outpath = os.path.join(ci.paths.get_ipath_cur("scripts"), "part-001")
- self.mock_write = self.mocker.replace("cloudinit.util.write_file", passthrough=False)
- self.mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
- self.mock_write(outpath, script, 0700)
+ mock_write = self.mocker.replace("cloudinit.util.write_file",
+ passthrough=False)
+ mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
+ mock_write(outpath, script, 0700)
self.mocker.replay()
log_file = self.capture_log(logging.WARNING)
@@ -192,9 +196,10 @@ p: 1
ci.datasource = FakeDataSource(message.as_string())
outpath = os.path.join(ci.paths.get_ipath_cur("scripts"), "part-001")
- self.mock_write = self.mocker.replace("cloudinit.util.write_file", passthrough=False)
- self.mock_write(outpath, script, 0700)
- self.mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
+ mock_write = self.mocker.replace("cloudinit.util.write_file",
+ passthrough=False)
+ mock_write(outpath, script, 0700)
+ mock_write(ci.paths.get_ipath("cloud_config"), "", 0600)
self.mocker.replay()
log_file = self.capture_log(logging.WARNING)