X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Fdbtest_contents.py;h=7ce61cd2eb2add993a84d37d594df1bba9c09bce;hb=1549379cef7c649ab3b65f7b44baaddef9339c08;hp=f36138dbf57852dd9cb384f63036e5ac9719c63c;hpb=0856760278c13dfe42ddffa54a7cdd1df5db9d1d;p=dak.git diff --git a/tests/dbtest_contents.py b/tests/dbtest_contents.py index f36138db..7ce61cd2 100755 --- a/tests/dbtest_contents.py +++ b/tests/dbtest_contents.py @@ -2,7 +2,8 @@ from db_test import DBDakTestCase -from daklib.dbconn import DBConn, BinContents, OverrideType +from daklib.dbconn import DBConn, BinContents, OverrideType, get_override_type, \ + Section, get_section, get_sections from sqlalchemy.exc import FlushError, IntegrityError import unittest @@ -66,6 +67,22 @@ class ContentsTestCase(DBDakTestCase): self.session.flush() self.assertEqual('deb', debtype.overridetype) self.assertEqual(0, debtype.overrides.count()) + self.assertEqual(debtype, get_override_type('deb', self.session)) + + def test_section(self): + ''' + Test Section class. + ''' + section = Section(section = 'python') + self.session.add(section) + self.session.flush() + self.assertEqual('python', section.section) + self.assertEqual('python', section) + self.assertTrue(section != 'java') + self.assertEqual(section, get_section('python', self.session)) + all_sections = get_sections(self.session) + self.assertEqual(section.section_id, all_sections['python']) + self.assertEqual(0, section.overrides.count()) if __name__ == '__main__': unittest.main()