aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_postprocessor.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2020-01-09 22:31:31 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2020-01-09 22:31:31 -0500
commit89bf167db5a998a217135f55593391a337bdad31 (patch)
treeadcd59e7b6f49e0826ef07f0f0e138282a8ae108 /test/test_postprocessor.py
parent3bf3f951e09ae597552e35996d843b554e593c78 (diff)
parentbc435e826dbe37969d9cbe280f58810d054932cc (diff)
Update upstream source from tag 'upstream/1.12.2'
Update to upstream version '1.12.2' with Debian dir 767bd062bb1809128547cb7c3ace169e3501bbcc
Diffstat (limited to 'test/test_postprocessor.py')
-rw-r--r--test/test_postprocessor.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py
index 17f82c9..629b0d7 100644
--- a/test/test_postprocessor.py
+++ b/test/test_postprocessor.py
@@ -7,6 +7,7 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
+import os
import os.path
import zipfile
import tempfile
@@ -156,7 +157,6 @@ class MetadataTest(BasePostprocessorTest):
"_private" : "world",
})
- self.assertEqual(pp.path , pp._path_append)
self.assertEqual(pp.write , pp._write_json)
self.assertEqual(pp.ascii , True)
self.assertEqual(pp.indent , 2)
@@ -242,7 +242,7 @@ class MetadataTest(BasePostprocessorTest):
"extension-format": "json",
})
- self.assertEqual(pp.path, pp._path_format)
+ self.assertEqual(pp._filename, pp._filename_custom)
with patch("builtins.open", mock_open()) as m:
pp.prepare(self.pathfmt)
@@ -264,6 +264,31 @@ class MetadataTest(BasePostprocessorTest):
path = self.pathfmt.realdirectory + "file.2.EXT-data:tESt"
m.assert_called_once_with(path, "w", encoding="utf-8")
+ def test_metadata_directory(self):
+ pp = self._create({
+ "directory": "metadata",
+ })
+
+ with patch("builtins.open", mock_open()) as m:
+ pp.prepare(self.pathfmt)
+ pp.run(self.pathfmt)
+
+ path = self.pathfmt.realdirectory + "metadata/file.ext.json"
+ m.assert_called_once_with(path, "w", encoding="utf-8")
+
+ def test_metadata_directory_2(self):
+ pp = self._create({
+ "directory" : "metadata////",
+ "extension-format": "json",
+ })
+
+ with patch("builtins.open", mock_open()) as m:
+ pp.prepare(self.pathfmt)
+ pp.run(self.pathfmt)
+
+ path = self.pathfmt.realdirectory + "metadata/file.json"
+ m.assert_called_once_with(path, "w", encoding="utf-8")
+
@staticmethod
def _output(mock):
return "".join(