def test_default_error(mocker): mocker.patch('collectd.error') global CONFIGS conf = MockConfig() configure_callback(conf) assert len(CONFIGS) == 0 collectd.error.assert_called_once_with('hadoop plugin error: *Host, Port, and Instance must be set.')
def assert_config(module_string, host, port, instance, instance_type): conf = MockConfig(module_string) configure_callback(conf) assert len(CONFIGS) == 1 config = CONFIGS[0] assert 'instance' in config assert config['instance'] == instance assert 'host' in config assert config['host'] == host assert 'port' in config assert config['port'] == port assert 'instance_type' in config assert config['instance_type'] == instance_type