################################################################################
-class OverrideType(object):
- def __init__(self, *args, **kwargs):
- pass
+class OverrideType(ORMObject):
+ def __init__(self, overridetype = None):
+ self.overridetype = overridetype
- def __repr__(self):
- return '<OverrideType %s>' % self.overridetype
+ def properties(self):
+ return ['overridetype', 'overridetype_id']
+
+ def not_null_constraints(self):
+ return ['overridetype']
__all__.append('OverrideType')
section_id = self.tbl_override.c.section,
section = relation(Section),
overridetype_id = self.tbl_override.c.type,
- overridetype = relation(OverrideType)))
+ overridetype = relation(OverrideType, \
+ backref=backref('overrides', lazy='dynamic'))))
mapper(OverrideType, self.tbl_override_type,
properties = dict(overridetype = self.tbl_override_type.c.type,
from db_test import DBDakTestCase
-from daklib.dbconn import DBConn, BinContents
+from daklib.dbconn import DBConn, BinContents, OverrideType
from sqlalchemy.exc import FlushError, IntegrityError
import unittest
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())
+
if __name__ == '__main__':
unittest.main()