def test_suicide_processing(db): def ships(): return db.query("SELECT * FROM ships").dictresult() assert len(ships()) == 4 add_order(db, 1, {"order": "suicide"}) assert len(ships()) == 4 process_ship_orders(db) assert len(ships()) == 3
def test_ftl_transit_processing(db): def transits(): return db.query("SELECT * FROM transit").dictresult() assert len(transits()) == 0 add_order(db, 1, {"order": "ftl", "origin": 1, "destination": 4}) assert len(transits()) == 0 process_ship_orders(db) assert len(transits()) == 1 assert transits()[0]["ship"] == 1 assert transits()[0]["destination"] == 4
def test_seizing_systems(db): from database.key_access import civ_systems def num_systems_for_civ1(): return len( db.query( "SELECT * FROM systems WHERE controller = 1").dictresult()) assert num_systems_for_civ1() == 2 add_order(db, 4, {"order": "seize"}) process_ship_orders(db) assert num_systems_for_civ1() == 1
def ship_orders_job(): process_ship_orders(app.db_conn())