def test_raises_if_icu_analysis_plugin_unavailable(self, client): client.conn.cat.plugins.return_value = '' with pytest.raises(RuntimeError) as e: init(client) assert 'plugin is not installed' in str(e.value)
def test_does_not_recreate_extant_index(self, client, configure_index): """Exits early if the index (or an alias) already exists.""" client.conn.indices.exists.return_value = True init(client) assert not configure_index.called
def test_configures_alias(self, mock_es_client): """Adds an alias to the newly-created index.""" init(mock_es_client) mock_es_client.conn.indices.put_alias.assert_called_once_with( index="foo-abcd1234", name=mock_es_client.index )
def test_raises_if_icu_analysis_plugin_unavailable(self, mock_es_client): mock_es_client.conn.cat.plugins.return_value = "" with pytest.raises(RuntimeError) as e: init(mock_es_client) assert "plugin is not installed" in str(e.value)
def test_configures_alias(self, client): """Adds an alias to the newly-created index.""" init(client) client.conn.indices.put_alias.assert_called_once_with( index="foo-abcd1234", name="foo" )
def test_configures_alias(self, client): """Adds an alias to the newly-created index.""" init(client) client.conn.indices.put_alias.assert_called_once_with(index='foo-abcd1234', name='foo')
def test_configures_index_when_index_missing(self, client, configure_index): """Calls configure_index when one doesn't exist.""" init(client) configure_index.assert_called_once_with(client)
def test_skips_plugin_check(self, client, configure_index): client.conn.cat.plugins.return_value = '' init(client, check_icu_plugin=False) configure_index.assert_called_once_with(client)
def test_skips_plugin_check(self, client, configure_index): client.conn.cat.plugins.return_value = "" init(client, check_icu_plugin=False) configure_index.assert_called_once_with(client)