]> git.phdru.name Git - m_librarian.git/blobdiff - tests/test_format.py
Feat(db): Add book.author1 property
[m_librarian.git] / tests / test_format.py
old mode 100755 (executable)
new mode 100644 (file)
index 9d52fb9..8d46e67
@@ -1,18 +1,15 @@
-#! /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._do_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'