Пример #1
0
def unregister(name, function):
    hook = config_global.get_attr("$hooks." + name)
    if hook:
        hook.remove(function)
        if hook:
            config_global.set_attr("$hooks." + name, list(hook))
        else:
            config_global.set_attr(__prefix + "." + name, None)
Пример #2
0
def cli(command, key_value):
    """View and set the user-defined properties. This properties is kept after logout. The format of KEY_VALUE: key1=value1 key2=value2. The empty value remove the key"""
    if command == 'set':
        for element in key_value:
            key, value = element.split('=')
            config_global.set_attr(key, treat_value(value))
    elif command == 'ls':
        print("config file: " + config_global.get_config_file() + "\n")
        for k, v in config_global.list_attr(key_value):
            print(k + " = " + str(v))
Пример #3
0
 def test_start_hook(self):
     with mock.patch('neoload_cli_lib.docker_lib.start_infra',
                     return_value=None) as mock_method:
         config_global.reset()
         config_global.set_attr(docker_lib.DOCKER_ZONE, "aze")
         docker_lib.hook_test_start({
             'controllerZoneId': 'aze',
             'lgZoneIds': {
                 'aze': 2
             }
         })
         mock_method.assert_has_calls([mock.call('aze', 1, 2, False, None)])
Пример #4
0
def add_set(key, list_to_add):
    old_list = get_setting(key)
    config_global.set_attr(key, old_list + list_to_add)
Пример #5
0
def forget():
    config_global.set_attr(DOCKER_LAUNCHED, None)
Пример #6
0
def register(name, function):
    hook = config_global.get_attr(__prefix + "." + name)
    hook_set = set(hook) if hook else set()

    hook_set.add(function)
    config_global.set_attr(__prefix + "." + name, list(hook_set))