]> git.phdru.name Git - m_librarian.git/blob - tests/test_inp.py
ff3cfa4f0884905acf3a59e1ccea66a0a5c9ae38
[m_librarian.git] / tests / test_inp.py
1 #! /usr/bin/env python
2
3
4 import os
5 from tests import TestCase, main
6 from m_librarian.db import Author, Book
7 from m_librarian.inp import import_inpx
8
9
10 class TestInp(TestCase):
11     def test_import_bad_inpx(self):
12         self.assertRaises(
13             ValueError, import_inpx,
14             os.path.join(os.path.dirname(__file__), 'bad.inpx'))
15
16     def test_import_inpx(self):
17         import_inpx(os.path.join(os.path.dirname(__file__), 'test.inpx'))
18         self.assertEqual(Author.select().count(), 4)
19         self.assertEqual(Book.select().count(), 4)
20
21
22 if __name__ == "__main__":
23     main()