def test_write_all_market_order_data(self): # There's a chance this test can fail due to timing issues Scraper.update_market_order_data(self._connection.session, self.region) crest_items = MarketOrder.get_objects_from_crest(self.eve, region=self.region) for item in crest_items: if Item.get_from_db_by_id(self._connection.session, item.type) is not None: self.assertTrue(MarketOrder.is_crest_item_in_db(self._connection.session, item))
def update_market_order_data(sql_session, region): eve = CrestConnection() crest_items = MarketOrder.get_objects_from_crest(eve, region=region) for item in crest_items: i = True if Item.get_from_db_by_id(sql_session, item.type) is None: try: i = Item.get_crest_item_by_attr(eve, 'id', item.type) Item.create_from_crest_data(sql_session, i, write=True) i = True except ValueError: i = False if i: MarketOrder.create_from_crest_data(sql_session, item, write=True)