X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Fdbtest_contents.py;h=7ce61cd2eb2add993a84d37d594df1bba9c09bce;hb=1549379cef7c649ab3b65f7b44baaddef9339c08;hp=9844513227357534d4f44f321848790496ab2cee;hpb=e7af2430da903cb25cb826cdb6be44d0ea1f54fc;p=dak.git diff --git a/tests/dbtest_contents.py b/tests/dbtest_contents.py index 98445132..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, get_override_type +from daklib.dbconn import DBConn, BinContents, OverrideType, get_override_type, \ + Section, get_section, get_sections from sqlalchemy.exc import FlushError, IntegrityError import unittest @@ -68,5 +69,20 @@ class ContentsTestCase(DBDakTestCase): 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()