""" open/dulcinea/lib/property/test/utest_property_db.py """ from dulcinea.common import CommonTest from dulcinea.property import get_property_db from dulcinea.property.property_template import MasterTemplate from dulcinea.property.property_type import get_string_property_type from sancho.utest import raises class PropertyDatabaseTest (CommonTest): def check_master_templates(self): if get_property_db() is None: return property_db = get_property_db() raises(TypeError, property_db.add_master_template, 'foo') s = get_string_property_type() self.foo = MasterTemplate('foo',s) self.bar = MasterTemplate('bar',s) raises(ValueError, property_db.rename_master_template, self.bar,'foo') property_db.add_master_template(self.foo) property_db.add_master_template(self.bar) raises(ValueError, property_db.add_master_template, self.foo) raises(ValueError, property_db.rename_master_template, self.bar, 'foo') property_db.rename_master_template(self.bar,'baz') assert self.bar == property_db.get_master_template('baz') if __name__ == "__main__": PropertyDatabaseTest()