class UrlsTestCase(TestCase): def setUp(self): super(UrlsTestCase, self).setUp() self._elastic_search_urls = Urls(config=MockConfig()) def test_index_url(self): assert self._elastic_search_urls.index_url( ) == 'http://localhost:9200/impim-test' def test_type_url(self): assert self._elastic_search_urls.type_url( Urls.IMAGE_TYPE) == 'http://localhost:9200/impim-test/image' def test_document_url(self): assert self._elastic_search_urls.document_url( Urls.IMAGE_TYPE, 1) == 'http://localhost:9200/impim-test/image/1' def test_search_url(self): assert self._elastic_search_urls.search_url( Urls.IMAGE_TYPE, q='search term' ) == 'http://localhost:9200/impim-test/image/_search?q=search+term' def test_refresh_url(self): assert self._elastic_search_urls.refresh_url( ) == 'http://localhost:9200/impim-test/_refresh'
class ElasticSearchForTest(object): def __init__(self, config, http_client): self._http_client = http_client self._elastic_search_urls = Urls(config) def refresh(self): self._http_client.post(self._elastic_search_urls.refresh_url(), '') def cleanup(self): self._http_client.delete(self._elastic_search_urls.index_url())
class ElasticSearchForTest(object): def __init__(self, config, http_client): self._http_client = http_client self._elastic_search_urls = Urls(config) def refresh(self): self._http_client.post(self._elastic_search_urls.refresh_url(), '') def cleanup(self): self._http_client.delete(self._elastic_search_urls.index_url())
class UrlsTestCase(TestCase): def setUp(self): super(UrlsTestCase, self).setUp() self._elastic_search_urls = Urls(config=MockConfig()) def test_index_url(self): assert self._elastic_search_urls.index_url() == 'http://localhost:9200/impim-test' def test_type_url(self): assert self._elastic_search_urls.type_url(Urls.IMAGE_TYPE) == 'http://localhost:9200/impim-test/image' def test_document_url(self): assert self._elastic_search_urls.document_url(Urls.IMAGE_TYPE, 1) == 'http://localhost:9200/impim-test/image/1' def test_search_url(self): assert self._elastic_search_urls.search_url(Urls.IMAGE_TYPE, q='search term') == 'http://localhost:9200/impim-test/image/_search?q=search+term' def test_refresh_url(self): assert self._elastic_search_urls.refresh_url() == 'http://localhost:9200/impim-test/_refresh'