diff options
| author | 2021-06-22 22:30:36 -0400 | |
|---|---|---|
| committer | 2021-06-22 22:30:36 -0400 | |
| commit | 32de2b06db501c7de81678bce8e3e0c3e63d340c (patch) | |
| tree | fd58a26618a73de0faaf3e9c435a806aed7eced3 /test/test_postprocessor.py | |
| parent | 8a644b7a06c504263a478d3681eed10b4161b5be (diff) | |
New upstream version 1.18.0.upstream/1.18.0
Diffstat (limited to 'test/test_postprocessor.py')
| -rw-r--r-- | test/test_postprocessor.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py index 6bf887c..00c17b2 100644 --- a/test/test_postprocessor.py +++ b/test/test_postprocessor.py @@ -30,13 +30,17 @@ class MockPostprocessorModule(Mock): class FakeJob(): - def __init__(self): - self.extractor = extractor.find("test:") - self.pathfmt = util.PathFormat(self.extractor) + def __init__(self, extr=extractor.find("test:")): + self.extractor = extr + self.pathfmt = util.PathFormat(extr) self.out = output.NullOutput() self.get_logger = logging.getLogger self.hooks = collections.defaultdict(list) + def register_hooks(self, hooks, options): + for hook, callback in hooks.items(): + self.hooks[hook].append(callback) + class TestPostprocessorModule(unittest.TestCase): @@ -239,6 +243,15 @@ class MetadataTest(BasePostprocessorTest): self._trigger() self.assertEqual(self._output(m), "foo\nbar\nbaz\n") + def test_metadata_tags_dict(self): + self._create( + {"mode": "tags"}, + {"tags": {"g": ["foobar1", "foobar2"], "m": ["foobarbaz"]}}, + ) + with patch("builtins.open", mock_open()) as m: + self._trigger() + self.assertEqual(self._output(m), "foobar1\nfoobar2\nfoobarbaz\n") + def test_metadata_custom(self): def test(pp_info): pp = self._create(pp_info, {"foo": "bar"}) |
