Added tests for query_history