aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_processing.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tests/test_processing.py')
-rw-r--r--mediagoblin/tests/test_processing.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_processing.py b/mediagoblin/tests/test_processing.py
new file mode 100644
index 00000000..417f91f3
--- /dev/null
+++ b/mediagoblin/tests/test_processing.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+from nose.tools import assert_equal, assert_true, assert_false
+
+from mediagoblin import processing
+
+class TestProcessing(object):
+ def run_fill(self, input, format, output=None):
+ builder = processing.FilenameBuilder(input)
+ result = builder.fill(format)
+ if output is None:
+ return result
+ assert_equal(output, result)
+
+ def test_easy_filename_fill(self):
+ self.run_fill('/home/user/foo.TXT', '{basename}bar{ext}', 'foobar.txt')
+
+ def test_long_filename_fill(self):
+ self.run_fill('{0}.png'.format('A' * 300), 'image-{basename}{ext}',
+ 'image-{0}.png'.format('A' * 245))