def test_get_instance_return_500(self, request_mock):
     expected_msg = 'HTTP 500: xubi'
     try:
         search_engine.get_instance("index", "type", "id")
     except ClientHTTPError as e:
         self.assertEqual(e.code, 500)
         self.assertEqual(e.message, expected_msg)
 def test_get_instance_return_500(self, request_mock):
     expected_msg = 'HTTP 500: xubi'
     try:
         search_engine.get_instance("index", "type", "id")
     except ClientHTTPError as e:
         self.assertEqual(e.code, 500)
         self.assertEqual(e.message, expected_msg)
 def test_get_instance_returns_none(self, request_mock):
     self.assertIsNone(search_engine.get_instance("index", "type", "id"))
 def test_get_instance_return_200(self, request_mock):
     instance = search_engine.get_instance("index", "type", "id")
     self.assertEqual(instance, {"my_instance": 123})
Esempio n. 5
0
def get_stored_query(query_id):
    stored_query = get_instance(ES_INDEX_NAME, ES_TYPE_NAME, query_id)
    if stored_query is not None:
        stored_query = stored_query["_source"]
        return stored_query
 def test_get_instance_returns_none(self, request_mock):
     self.assertIsNone(search_engine.get_instance("index", "type", "id"))
 def test_get_instance_return_200(self, request_mock):
     instance = search_engine.get_instance("index", "type", "id")
     self.assertEqual(instance, {"my_instance": 123})
Esempio n. 8
0
def get_stored_query(query_id):
    stored_query = get_instance(ES_INDEX_NAME, ES_TYPE_NAME, query_id)
    if stored_query is not None:
        stored_query = stored_query["_source"]
        return stored_query