Beispiel #1
0
def clean_scenario(transaction):
    # This shouldn't be needed - controller class shouln't expose flask dependent params
    # TODO remove
    args = MultiDict([
        ('page_size', 10),
        ('page_num', 1),
        ('attr_format', 'both')
    ])
    req = {
        'headers': {
            'authorization': generate_token()
        },
        'args': args,
        'body': ''
    }

    params = {
        'page_size': 10,
        'page_num':  1,
        'attr_format': 'both',
        'attr': [],
        'attr_type': [],
        'idsOnly':'false'
    }

    token = generate_token()

    result = DeviceHandler.get_devices(token, params)

    for device in result['devices']:
        DeviceHandler.delete_device(device['id'], token)

    result = TemplateHandler.get_templates(params, token)
    for template in result['templates']:
        TemplateHandler.remove_template(template['id'], token)
Beispiel #2
0
def clean_scenario(transaction):
    # This shouldn't be needed - controller class shouln't expose flask dependent params
    # TODO remove
    args = MultiDict([('page_size', 10), ('page_num', 1),
                      ('attr_format', 'both')])
    req = {
        'headers': {
            'authorization': generate_token()
        },
        'args': args,
        'body': ''
    }

    result = DeviceHandler.get_devices(Request(req))
    for device in result['devices']:
        DeviceHandler.delete_device(Request(req), device['id'])

    result = TemplateHandler.get_templates(Request(req))
    for template in result['templates']:
        # print(template)
        TemplateHandler.remove_template(Request(req), template['id'])