def test_get_server_indices(self): """Assert indices are found for a given server.""" servers = {} indices = {'used': {}, 'not_used': {}} handler = ConnectionHandler(servers, indices) test_server = { 'INDICES': ['used'], } indices = handler.get_server_indices(test_server) expected_indices = { 'used': { 'NAME': 'used', 'ALIASES': [], 'SETTINGS': None, 'TEST': { 'NAME': 'used_test', 'ALIASES': [], 'SETTINGS': None, } } } assert indices == expected_indices
def test_get_server_indices(self): """Assert indices are found for a given server.""" servers = {} indices = { 'used': {}, 'not_used': {} } handler = ConnectionHandler(servers, indices) test_server = { 'INDICES': ['used'], } indices = handler.get_server_indices(test_server) expected_indices = { 'used': { 'NAME': 'used', 'ALIASES': [], 'SETTINGS': None, 'TEST': { 'NAME': 'used_test', 'ALIASES': [], 'SETTINGS': None, } } } assert indices == expected_indices
def test_empty_get_server_indices(self): """Assert there is no index by default, ie. `_all` will be used. ElasticSearch allows query on all indices. It is not safe for testing purposes, but it does not have to be checked in the connection handler. """ handler = ConnectionHandler({}, {}) # Yes, it is acceptable to get indices from a non-configured servers. # The purpose of get_server_indices is not to validate the input. test_server = {'INDICES': []} indices = handler.get_server_indices(test_server) assert indices == {}
def test_empty_get_server_indices(self): """Assert there is no index by default, ie. `_all` will be used. ElasticSearch allows query on all indices. It is not safe for testing purposes, but it does not have to be checked in the connection handler. """ handler = ConnectionHandler({}, {}) # Yes, it is acceptable to get indices from a non-configured servers. # The purpose of get_server_indices is not to validate the input. test_server = { 'INDICES': [] } indices = handler.get_server_indices(test_server) assert indices == {}