X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Fdbtest_contents.py;h=7ce61cd2eb2add993a84d37d594df1bba9c09bce;hb=1549379cef7c649ab3b65f7b44baaddef9339c08;hp=d6619e70e630d1d46970da8799b52ec8fe33c438;hpb=a4b3758ff560961d45155225a3af66a3c45fe8be;p=dak.git diff --git a/tests/dbtest_contents.py b/tests/dbtest_contents.py index d6619e70..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 +from daklib.dbconn import DBConn, BinContents, OverrideType, get_override_type, \ + Section, get_section, get_sections from sqlalchemy.exc import FlushError, IntegrityError import unittest @@ -57,5 +58,31 @@ class ContentsTestCase(DBDakTestCase): self.session.add(contents2) self.session.flush() + def test_overridetype(self): + ''' + Test the OverrideType class. + ''' + debtype = OverrideType(overridetype = 'deb') + self.session.add(debtype) + 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()