Merged test_sqlalchemy.py with test_mwdb.py.
[philipp/winterrodeln/wrpylib.git] / tests / test_mwdb.py
index cce9f2d10bddc76437d7a2e40855b9071ddf5d13..94d40b12a4218d929b1cf60f4039c7b7cbc371fc 100644 (file)
@@ -23,23 +23,41 @@ class TestMwDb(unittest.TestCase):
         Page = wrpylib.mwdb.page_table(self.metadata)
         page = self.session.query(Page).filter(Page.c.page_id==1321).first()
         self.assertEqual(page.page_id, 1321)
+        self.assertEqual(type(page.page_title), str)
+        self.assertEqual(type(page.page_restrictions), bytes)
+        self.assertEqual(type(page.page_touched), str)
 
     def test_revision_table(self):
         Revision = wrpylib.mwdb.revision_table(self.metadata)
         revision = self.session.query(Revision).filter(Revision.c.rev_id == 666).first()
         self.assertEqual(revision.rev_id, 666)
+        self.assertEqual(type(revision.rev_comment), str)
+        self.assertEqual(type(revision.rev_user_text), str)
+        self.assertEqual(type(revision.rev_timestamp), str)
 
     def test_text_table(self):
         Text = wrpylib.mwdb.text_table(self.metadata)
         text = self.session.query(Text).filter(Text.c.old_id == 51).first()
         self.assertEqual(text.old_id, 51)
+        self.assertEqual(type(text.old_text), str)
+        self.assertEqual(type(text.old_flags), str)
+        self.assertEqual(text.old_flags, 'utf-8')
+
 
     def test_user_table(self):
         User = wrpylib.mwdb.user_table(self.metadata)
-        user = self.session.query(User).filter(User.c.user_id == 5).first()
-        self.assertEqual(user.user_id, 5)
+        user = self.session.query(User).filter(User.c.user_id == 1).first()
+        self.assertEqual(user.user_id, 1)
+        self.assertEqual(type(user.user_name), str)
+        self.assertEqual(type(user.user_real_name), str)
+        self.assertEqual(type(user.user_email), str)
+        self.assertEqual(user.user_name, 'Philipp')
+
 
     def test_categorylinks_table(self):
         Categorylinks = wrpylib.mwdb.categorylinks_table(self.metadata)
-        categorylinks = self.session.query(Categorylinks).filter(Categorylinks.c.cl_from == 229).first()
-        self.assertEqual(categorylinks.cl_from, 229)
+        categorylinks = self.session.query(Categorylinks).filter(Categorylinks.c.cl_from == 609).first()
+        self.assertEqual(categorylinks.cl_from, 609)
+        self.assertEqual(type(categorylinks.cl_to), str)
+        self.assertEqual(type(categorylinks.cl_sortkey), str)
+        self.assertEqual(categorylinks.cl_sortkey, 'ALT BĂ„RNBAD')