diff options
author | Daniel Watkins <oddbloke@ubuntu.com> | 2020-06-17 12:59:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 10:59:23 -0600 |
commit | 3d13a9dd469f354d0ddc1e36be37d743b5a57c73 (patch) | |
tree | eb6fbcf7f66c5c67e7703858f93369e8934b9c34 /tests/unittests | |
parent | e01e3ed5444c8093de47229e20abec440530d549 (diff) | |
download | vyos-cloud-init-3d13a9dd469f354d0ddc1e36be37d743b5a57c73.tar.gz vyos-cloud-init-3d13a9dd469f354d0ddc1e36be37d743b5a57c73.zip |
util: rename write_file's copy_mode parameter to preserve_mode (#439)
When updating the docstring to include it, I realised that the current
name is somewhat misleading; this makes it a little easier to
understand, I think.
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_util.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 737dda8b..0821341f 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -110,29 +110,29 @@ class TestWriteFile(helpers.TestCase): file_stat = os.stat(path) self.assertEqual(0o666, stat.S_IMODE(file_stat.st_mode)) - def test_copy_mode_no_existing(self): - """Verify that file is created with mode 0o644 if copy_mode + def test_preserve_mode_no_existing(self): + """Verify that file is created with mode 0o644 if preserve_mode is true and there is no prior existing file.""" path = os.path.join(self.tmp, "NewFile.txt") contents = "Hey there" - util.write_file(path, contents, copy_mode=True) + util.write_file(path, contents, preserve_mode=True) self.assertTrue(os.path.exists(path)) self.assertTrue(os.path.isfile(path)) file_stat = os.stat(path) self.assertEqual(0o644, stat.S_IMODE(file_stat.st_mode)) - def test_copy_mode_with_existing(self): + def test_preserve_mode_with_existing(self): """Verify that file is created using mode of existing file - if copy_mode is true.""" + if preserve_mode is true.""" path = os.path.join(self.tmp, "NewFile.txt") contents = "Hey there" open(path, 'w').close() os.chmod(path, 0o666) - util.write_file(path, contents, copy_mode=True) + util.write_file(path, contents, preserve_mode=True) self.assertTrue(os.path.exists(path)) self.assertTrue(os.path.isfile(path)) |