def test_update_indexes_in_alias__no_backup(self): es = Mock() es.indices.exists_alias.side_effect = [True, False] expected = {'actions': [{'add': {'index': 'bar', 'alias': 'foo'}}]} sut.update_indexes_in_alias(es, self.logger, 'foo', 'baz', 'bar') es.indices.update_aliases.assert_called_once_with(body=expected)
def test_update_indexes_in_alias__no_aliases(self): es = Mock() es.indices.exists_alias.side_effect = [False] sut.update_indexes_in_alias(es, self.logger, 'foo', 'baz', 'bar') es.indices.put_alias.assert_called_once_with(name='foo', index='bar')