blob: 09edd603799ee3dc24921b854f568333b01bcba2 [file] [log] [blame]
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit test for ElasticSearch mock."""
from __future__ import print_function
import unittest
from chromite.lib.graphite_lib import elasticsearch_mock as elasticsearch
class statsd_mock_test(unittest.TestCase):
"""Test statsd_mock"""
def setUp(self): = elasticsearch.Elasticsearch(host='host',
def test_index_call_mock(self):
"""Test mock Elasticsearch.index method"""'blah', doc_type='blah blah', body='random')
def test_index_exists_mock(self):
"""Test mock Elasticsearch.indices.exists method"""'random index')
def test_index_delete_mock(self):
"""Test mock Elasticsearch.indices.delete method"""'random index')
def test_search_mock(self):
"""Test mock method"""'index', body='query')
def test_exception_mock(self):
"""Test mock elasticsearch.ElasticsearchException method"""
raise elasticsearch.ElasticsearchException('error message')
except elasticsearch.ElasticsearchException: