Esempio n. 1
0
    def setUp(self):
        self.persistence_manager = PersistenceManager(True)

        #just keep a top level reference to these guys for ease of use
        self.session = db_connector.get_session()

        #and then create the database schema, reference tables
        self.persistence_manager.create_schema()
        self.persistence_manager.populate_reference_tables()
        self.session.commit()
Esempio n. 2
0
    def setUp(self):
        self.persistence_manager = PersistenceManager(True)

        #just keep a top level reference to these guys for ease of use
        self.session = db_connector.get_session()

        #and then create the database schema, reference tables
        self.persistence_manager.create_schema()
        self.persistence_manager.populate_reference_tables()
        self.session.commit()
Esempio n. 3
0
    def setUp(self):

        user = os.environ["USER"]
        password = os.environ["PASSWORD"]
        sqlfile = "./dbs/prod.sql"
        cmd = "/usr/local/mysql/bin/mysql -u %s -p%s 'sozin$lists' < %s" % (user, password, sqlfile)

        print os.system(cmd)

        self.pm = PersistenceManager(db_connector)
        self.session = db_connector.get_session()
Esempio n. 4
0
    def setUp(self):

        user = os.environ['USER']
        password = os.environ['PASSWORD']
        sqlfile = "./dbs/prod.sql"
        cmd = "/usr/local/mysql/bin/mysql -u %s -p%s 'sozin$lists' < %s" % (
            user, password, sqlfile)

        print os.system(cmd)

        self.pm = PersistenceManager(db_connector)
        self.session = db_connector.get_session()
Esempio n. 5
0
 def setUp(self):
     self.session = db_connector.get_session()
     self.pm  = PersistenceManager(myapp.db_connector)
Esempio n. 6
0
 def setUp(self):
     self.session = db_connector.get_session()
     self.pm = PersistenceManager(myapp.db_connector)
Esempio n. 7
0
class TestPersistence(DatabaseTestCase):

    #@unittest.skip("because")
    def testSchemaConstruction(self):
        self.assertTrue(True)



if __name__ == "__main__":
    if len (sys.argv) == 1:
        unittest.main()
    elif sys.argv[1] == 'create':
        pm = PersistenceManager(db_connector)
        pm.create_schema()
        #pm.populate_reference_tables()
        db_connector.get_session().commit()
        db_connector.get_session().close_all()
    elif sys.argv[1] == 'destroy':
        pm = PersistenceManager(db_connector)
        pm.drop_schema()
        db_connector.get_session().commit()
        db_connector.get_session().close_all()
    elif sys.argv[1] == 'alter':
        pm = PersistenceManager(db_connector)
        #update all records in the ship_pilot table

        meta = XWingMetaData()
        #upgrades = meta.upgrades()
        #pm.create_upgrade_table()
        # upgrade_objects = []
        # for ut in upgrades.keys():
Esempio n. 8
0
        self.assertEqual( DiceFace.EVADE, adjustment.to_dice.dice_face)

        result = throw.results[2]
        self.assertEqual( 3, result.dice_num)
        self.assertEqual( DiceType.GREEN, result.dice.dice_type)
        self.assertEqual( DiceFace.FOCUS, result.dice.dice_face)
        self.assertEqual( DiceFace.EVADE, result.final_dice.dice_face)
        self.assertEqual( 1, len (result.adjustments))

        adjustment = result.adjustments[0]
        self.assertEqual( adjustment.base_result_id, result.id)
        self.assertEqual( DiceThrowAdjustmentType.CONVERT, adjustment.adjustment_type)
        self.assertEqual( DiceFace.FOCUS, adjustment.from_dice.dice_face )
        self.assertEqual( DiceFace.EVADE, adjustment.to_dice.dice_face)



if __name__ == "__main__":
    if len (sys.argv) == 1:
        unittest.main()
    elif sys.argv[1] == 'create':
        pm = PersistenceManager(db_connector)
        pm.create_schema()
        pm.populate_reference_tables()
        db_connector.get_session().commit()
        db_connector.get_session().close_all()
    elif sys.argv[1] == 'destroy':
        pm = PersistenceManager(db_connector)
        pm.drop_schema()
        db_connector.get_session().commit()
        db_connector.get_session().close_all()