Commit | Line | Data |
---|---|---|
095fbdaf BS |
1 | #!/usr/bin/env python |
2 | ||
a855e92a | 3 | from nose.tools import assert_equal |
095fbdaf BS |
4 | |
5 | from mediagoblin import processing | |
6 | ||
7 | class TestProcessing(object): | |
28f364bd BS |
8 | def run_fill(self, input, format, output=None): |
9 | builder = processing.FilenameBuilder(input) | |
10 | result = builder.fill(format) | |
095fbdaf BS |
11 | if output is None: |
12 | return result | |
13 | assert_equal(output, result) | |
14 | ||
28f364bd BS |
15 | def test_easy_filename_fill(self): |
16 | self.run_fill('/home/user/foo.TXT', '{basename}bar{ext}', 'foobar.txt') | |
095fbdaf | 17 | |
28f364bd BS |
18 | def test_long_filename_fill(self): |
19 | self.run_fill('{0}.png'.format('A' * 300), 'image-{basename}{ext}', | |
20 | 'image-{0}.png'.format('A' * 245)) |