diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-03-27 21:04:42 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-03-27 21:04:42 +0000 |
commit | c613b172a44c98f40919c763eb4bf088476cbefa (patch) | |
tree | 5588ec806339b1840d6efec76f4faf0813b036a5 /tests | |
parent | cfefd80c828c309745cc40d8498223b4fbc7b5ca (diff) | |
download | sos-c613b172a44c98f40919c763eb4bf088476cbefa.tar.gz |
Add tests for Plugin.add_copy_spec()/add_copy_specs()
Give add_copy_spec() and add_copy_specs() their own test cases.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/plugin_tests.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index 5074cbf9..a4905cf9 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -211,7 +211,9 @@ class PluginTests(unittest.TestCase): self.assertEquals(p.archive.m, {}) -class AddCopySpecLimitTests(unittest.TestCase): +class AddCopySpecTests(unittest.TestCase): + + expect_paths = set(['tests/tail_test.txt']) def setUp(self): self.mp = MockPlugin({ @@ -219,9 +221,29 @@ class AddCopySpecLimitTests(unittest.TestCase): }) self.mp.archive = MockArchive() + def assert_expect_paths(self): + self.assertEquals(self.mp.copy_paths, self.expect_paths) + + # add_copy_spec() + + def test_single_file(self): + self.mp.add_copy_spec('tests/tail_test.txt') + self.assert_expect_paths() + def test_glob_file(self): + self.mp.add_copy_spec('tests/tail_test.*') + self.assert_expect_paths() + def test_single_file_under_limit(self): self.mp.add_copy_spec_limit("tests/tail_test.txt", 1) - self.assertEquals(self.mp.copy_paths, set(['tests/tail_test.txt'])) + self.assert_expect_paths() + + # add_copy_specs() + + def test_add_copy_specs(self): + self.mp.add_copy_specs(["tests/tail_test.txt"]) + self.assert_expect_paths() + + # add_copy_spec_limit() def test_single_file_over_limit(self): fn = create_file(2) # create 2MB file, consider a context manager |