def run_all(cls, conf):
     top_module_name = conf['package_name']   # You need to create this, thank you. WD-rpw 03-10-2010
     mod = __import__(top_module_name + ".websetup.bootstrap_data", fromlist=[top_module_name, "websetup"])
     for modname in dir(mod):
         if modname.startswith("bootstrap"):
             fully_qualified_mod_name = "%s.websetup.bootstrap_data.%s" % (top_module_name, modname)
             dmigration = DataMigration(fully_qualified_mod_name)
             if dmigration.migration_needs_to_run():
                 mod = sys.modules[ fully_qualified_mod_name ]
                 mod.upgrade(conf)
                 DBSession.add(dmigration)
     transaction.commit()
 def setUp(self):
     """Prepare model test fixture."""
     try:
         new_attrs = {}
         new_attrs.update(self.attrs)
         new_attrs.update(self.do_get_dependencies())
         self.obj = self.klass(**new_attrs)
         DBSession.add(self.obj)
         DBSession.flush()
         return self.obj
     except:
         DBSession.rollback()
         raise
 def migration_needs_to_run(self):
     return DBSession.query(DataMigration).filter_by(unique_code = self.unique_code).count() == 0
 def test_query_obj(self):
     """Model objects can be queried"""
     obj = DBSession.query(self.klass).one()
     for key, value in self.attrs.iteritems():
         assert_equals(getattr(obj, key), value)
 def tearDown(self):
     """Finish model test fixture."""
     DBSession.rollback()