aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2020-01-09 22:31:29 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2020-01-09 22:31:29 -0500
commitbc435e826dbe37969d9cbe280f58810d054932cc (patch)
tree4c12d1bd5d5fdaa4f6a65c38c85dd8f0ecdadc6b /test
parentf9a1a9dcb7df977eeac9544786df9c0b93795815 (diff)
New upstream version 1.12.2upstream/1.12.2
Diffstat (limited to 'test')
-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(