test_processing.py 617 B

12345678910111213141516171819
  1. #!/usr/bin/env python
  2. from mediagoblin import processing
  3. class TestProcessing(object):
  4. def run_fill(self, input, format, output=None):
  5. builder = processing.FilenameBuilder(input)
  6. result = builder.fill(format)
  7. if output is None:
  8. return result
  9. assert output == result
  10. def test_easy_filename_fill(self):
  11. self.run_fill('/home/user/foo.TXT', '{basename}bar{ext}', 'foobar.txt')
  12. def test_long_filename_fill(self):
  13. self.run_fill('{0}.png'.format('A' * 300), 'image-{basename}{ext}',
  14. 'image-{0}.png'.format('A' * 245))