def test_get_index_statuses(self): index = self._create_index() status = pylastica.Status(index.client) statuses = status.index_statuses self.assertIsInstance(statuses, list) for index_status in statuses: self.assertIsInstance(index_status, pylastica.index.Status) index.delete()
def test_get_index_names(self): index_name = 'test' client = self._get_client() index = client.get_index(index_name) index.create(options=True) status = pylastica.Status(client) names = status.index_names self.assertIsInstance(names, list) self.assertTrue(index.name in names) for name in names: self.assertIsInstance(name, unicode) index.delete()
def test_alias_exists(self): alias_name = 'pylastica_test-alias' index = self._create_index() status = pylastica.Status(index.client) for tmp_index in status.get_indices_with_alias(alias_name): tmp_index.remove_alias(alias_name) self.assertFalse(status.alias_exists(alias_name)) index.add_alias(alias_name) status.refresh() self.assertTrue(status.alias_exists(alias_name)) index.delete()
def test_index_exists(self): index_name = 'pylastica_test' client = self._get_client() index = client.get_index(index_name) try: index.delete() except pylastica.exception.ResponseException as e: pass status = pylastica.Status(client) self.assertFalse(status.index_exists(index_name)) index.create() status.refresh() self.assertTrue(status.index_exists(index_name)) index.delete()
def test_get_response(self): index = self._create_index() status = pylastica.Status(index.client) self.assertIsInstance(status.response, pylastica.Response) index.delete()