Add tests for rate_query function