diff options
author | Andrew Jorgensen <ajorgens@amazon.com> | 2017-06-16 18:17:36 +0000 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-07-11 13:33:02 -0400 |
commit | 4330a98161a5c514c7f85a76a58d057c85b00174 (patch) | |
tree | 2abde8be1f6f92db7c337961ed9abb9a95c8d453 /tests/unittests/test_handler/test_handler_write_files.py | |
parent | a703c6a8b67bb56cb76bec65a67e62d344923ca8 (diff) | |
download | vyos-cloud-init-4330a98161a5c514c7f85a76a58d057c85b00174.tar.gz vyos-cloud-init-4330a98161a5c514c7f85a76a58d057c85b00174.zip |
write_files: Remove log from helper function signatures.
Instead of passing around a 'log' reference to functions, just import
logging and use that. This is the pattern that is now more common in
cloud-init.
Diffstat (limited to 'tests/unittests/test_handler/test_handler_write_files.py')
-rw-r--r-- | tests/unittests/test_handler/test_handler_write_files.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/unittests/test_handler/test_handler_write_files.py b/tests/unittests/test_handler/test_handler_write_files.py index 88a4742b..1129e77d 100644 --- a/tests/unittests/test_handler/test_handler_write_files.py +++ b/tests/unittests/test_handler/test_handler_write_files.py @@ -49,13 +49,13 @@ class TestWriteFiles(FilesystemMockingTestCase): expected = "hello world\n" filename = "/tmp/my.file" write_files( - "test_simple", [{"content": expected, "path": filename}], LOG) + "test_simple", [{"content": expected, "path": filename}]) self.assertEqual(util.load_file(filename), expected) def test_yaml_binary(self): self.patchUtils(self.tmp) data = util.load_yaml(YAML_TEXT) - write_files("testname", data['write_files'], LOG) + write_files("testname", data['write_files']) for path, content in YAML_CONTENT_EXPECTED.items(): self.assertEqual(util.load_file(path), content) @@ -87,7 +87,7 @@ class TestWriteFiles(FilesystemMockingTestCase): files.append(cur) expected.append((cur['path'], data)) - write_files("test_decoding", files, LOG) + write_files("test_decoding", files) for path, content in expected: self.assertEqual(util.load_file(path, decode=False), content) @@ -105,22 +105,22 @@ class TestDecodePerms(CiTestCase): def test_none_returns_default(self): """If None is passed as perms, then default should be returned.""" default = object() - found = decode_perms(None, default, self.logger) + found = decode_perms(None, default) self.assertEqual(default, found) def test_integer(self): """A valid integer should return itself.""" - found = decode_perms(0o755, None, self.logger) + found = decode_perms(0o755, None) self.assertEqual(0o755, found) def test_valid_octal_string(self): """A string should be read as octal.""" - found = decode_perms("644", None, self.logger) + found = decode_perms("644", None) self.assertEqual(0o644, found) def test_invalid_octal_string_returns_default_and_warns(self): """A string with invalid octal should warn and return default.""" - found = decode_perms("999", None, self.logger) + found = decode_perms("999", None) self.assertIsNone(found) self.assertIn("WARNING: Undecodable", self.logs.getvalue()) |