-#! /usr/bin/env python
+import os
+from m_librarian import download
+from m_librarian.config import get_config
-import unittest
-from tests import main
-from m_librarian import config, download
-
-class TestFormat(unittest.TestCase):
- def test_compile_format(self):
- config.get_config().set('download', 'format', '%a/%s/%n %t')
- download._compile_format()
- self.assertEqual(download.compiled_format,
- u'%(author)s/%(series)s/%(ser_no)d %(title)s')
-
-
-if __name__ == "__main__":
- main()
+def test_compile_format():
+ config_path = os.path.join(
+ os.path.dirname(__file__), 'test_config.conf')
+ get_config(config_path)
+ ml_conf = get_config()
+ ml_conf.set('download', 'format', '%a/%s/%n %t')
+ download._compile_format()
+ assert download.compiled_format == \
+ u'%(author1)s/%(series)s/%(ser_no)d %(title)s'