

def test_query(self):
    with open('elastic_recheck/tests/unit/logstash/1284371.analysis') as f:
        expected_stdout = f.read()
    with mock.patch('elastic_recheck.results.SearchEngine.search') as mock_search:
        with open('elastic_recheck/tests/unit/logstash/1284371.json') as f:
            jsonResponse = json.loads(f.read())
            mock_search.return_value = ResultSet(jsonResponse)
        query.query('elastic_recheck/tests/unit/queries/1284371.yaml')
        sys.stdout.seek(0)
        self.assertEqual(expected_stdout, sys.stdout.read())

dataset/ETHPy150Open openstack-infra/elastic-recheck/elastic_recheck/tests/unit/test_query.py TestQueryCmd.test_query/original