From 32de2b06db501c7de81678bce8e3e0c3e63d340c Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Tue, 22 Jun 2021 22:30:36 -0400 Subject: New upstream version 1.18.0. --- test/test_postprocessor.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'test/test_postprocessor.py') 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"}) -- cgit v1.2.3