def update_results_in_test_report(self, database, test_id, payload): """ :param database: :param test_id: :param payload: :return: """ table = StatementManager.test_report_schema() query = table.update().where( table.c.test_id == str(test_id)).values(payload) engine, connection = self.spawn_connection(database) results = self.execute_query(connection, query) self.close_connection(engine, connection) return results
def select_previous_passed_test_id(self, database): """ :param database: :return: """ table = StatementManager.test_report_schema() engine, connection = self.spawn_connection(database) query = select([ table.c.test_id ]).where(table.c.status == "1").order_by(table.c.id.desc()).limit(1) results = [ str(row.test_id) for row in self.execute_query(connection, query) ] self.close_connection(engine, connection) return results[0] if len(results) == 1 else None
def select_validated_test_ids(self, database, number=options. maximum_number_saved_test_results): """ :param database: :param number: :return: """ table = StatementManager.test_report_schema() engine, connection = self.spawn_connection(database) query = select([table.c.test_id]).distinct().limit(number) results = [ str(row.test_id) for row in self.execute_query(connection, query) ] self.close_connection(engine, connection) return results