コード例 #1
0
def create_random_forum_message():

    theme = random.choice(FORUM_THEMES)
    subject = id_generator(random.randint(1, 20))
    message = id_generator(random.randint(20, 200))

    return create_forum_body(theme=theme, subject=subject, message=message)
コード例 #2
0
def create_random_user():
    name = id_generator(6)
    username = id_generator(6)
    pwd = id_generator(6)
    role = random.choice(USER_ROLES)
    email = '{}@{}'.format(id_generator(6), id_generator(6))

    return create_user_body(name, username, pwd, role, email)
コード例 #3
0
ファイル: rules.py プロジェクト: carloslucenah/fiware-cloto
def given_a_group1_of_servers_in_a_tenant(step, number_servers):

    world.number_servers = int(number_servers)
    world.servers_body = []

    for x in range(world.number_servers):
        world.rules = []
        server_id = Utils.id_generator(size=6)
        number_rules = random.randint(1, 5)

        for rule in range(number_rules):
            rule_body = Rule_Utils.create_scale_specific_rule()
            req = api_utils.create_rule(world.tenant_id,
                                        server_id,
                                        body=rule_body)
            assert_true(req.ok,
                        HTTP_CODE_NOT_OK.format(req.status_code, req.content))
            rule_id = req.json()[RULE_ID]
            world.rules.append(
                Rule_Utils.create_rule_body(action=None,
                                            rule_id=rule_id,
                                            condition=None,
                                            name=rule_body['name']))

        server_dict = {SERVER_ID: server_id, RULES: world.rules}
        world.servers_body.append(server_dict)
コード例 #4
0
def retrieve_non_existent_subscription(step, server_id):

    world.server_id = server_id
    world.req = api_utils.retrieve_subscription(
        tenant_id=world.tenant_id,
        server_id=world.server_id,
        subscription_id=Utils.id_generator(10),
        headers=world.headers)
コード例 #5
0
ファイル: subscriptions.py プロジェクト: cgc951/fiware-cloto
def retrieve_non_existent_subscription(context, server_id):

    context.server_id = server_id
    context.req = api_utils.retrieve_subscription(
        tenant_id=context.tenant_id,
        server_id=context.server_id,
        subscription_id=Utils.id_generator(10),
        headers=context.headers)
コード例 #6
0
def retrieve_non_existent_subscription(step, server_id):

    world.server_id = server_id
    world.req = api_utils.retrieve_subscription(
        tenant_id=world.tenant_id,
        server_id=world.server_id,
        subscription_id=Utils.id_generator(10),
        headers=world.headers,
    )
コード例 #7
0
ファイル: subscriptions.py プロジェクト: Fiware/cloud.Cloto
def retrieve_subscription(context, server_id):

    if server_id == RANDOM:
        context.server_id = Utils.id_generator(10)
    else:
        context.server_id = server_id

    context.req = api_utils.retrieve_subscription(tenant_id=context.tenant_id, server_id=context.server_id,
                                                  subscription_id=context.subscription_id, headers=context.headers)
コード例 #8
0
def when_i_create_a_scale_rule_with_group1_and_group2(step, rule_name, action):

    if rule_name == 'random':
        rule_name = Utils.id_generator()

    action = Rule_Utils.create_rule_action_dict(action_name='notify-scale', operation=action)

    world.req = api_utils.create_rule(tenant_id=world.tenant_id, server_id=world.server_id, rule_name=rule_name,
                                      cpu=world.cpu, mem=world.mem, action=action, headers=world.headers)
コード例 #9
0
ファイル: rules.py プロジェクト: Fiware/cloud.Cloto
def when_i_create_a_scale_rule_with_group1_and_group2(context, rule_name, action):

    if rule_name == 'random':
        rule_name = Utils.id_generator()

    action = Rule_Utils.create_rule_action_dict(action_name='notify-scale', operation=action)

    context.req = api_utils.create_rule(tenant_id=context.tenant_id, server_id=context.server_id, rule_name=rule_name,
                                        cpu=context.cpu, mem=context.mem, hdd=context.hdd, net=context.net,
                                        action=action, headers=context.headers)
コード例 #10
0
ファイル: subscriptions.py プロジェクト: Fiware/cloud.Cloto
def new_subscription_in_server(context, server_id, url_to_notify):

    context.url_to_notify = url_to_notify
    if server_id == RANDOM:
        context.server_id = Utils.id_generator(10)
    else:
        context.server_id = server_id

    context.req = api_utils.create_subscription(tenant_id=context.tenant_id, server_id=context.server_id,
                                                rule_id=context.rule_id, url=context.url_to_notify,
                                                headers=context.headers)
コード例 #11
0
def retrieve_subscription(step, server_id):

    if server_id == RANDOM:
        world.server_id = Utils.id_generator(10)
    else:
        world.server_id = server_id

    world.req = api_utils.retrieve_subscription(
        tenant_id=world.tenant_id,
        server_id=world.server_id,
        subscription_id=world.subscription_id,
        headers=world.headers)
コード例 #12
0
ファイル: subscriptions.py プロジェクト: cgc951/fiware-cloto
def retrieve_subscription(context, server_id):

    if server_id == RANDOM:
        context.server_id = Utils.id_generator(10)
    else:
        context.server_id = server_id

    context.req = api_utils.retrieve_subscription(
        tenant_id=context.tenant_id,
        server_id=context.server_id,
        subscription_id=context.subscription_id,
        headers=context.headers)
コード例 #13
0
ファイル: rules.py プロジェクト: carloslucenah/fiware-cloto
def when_i_update_the_notify_rule_with_group1_group2_and_group3(step, new_name, new_body, new_mail, server_id):

    if new_name == RANDOM:
        world.rule_name = Utils.id_generator()
    else:
        world.rule_name = new_name
    world.server_id = server_id

    world.rule_action = Rule_Utils.create_rule_action_dict(action_name='notify-email', body=new_body, email=new_mail)

    world.req = api_utils.update_rule(tenant_id=world.tenant_id, server_id=world.server_id, rule_name=world.rule_name,
                                      cpu=world.cpu, mem=world.mem, hdd=world.hdd, net=world.net,
                                      action=world.rule_action, headers=world.headers, rule_id=world.rule_id)
コード例 #14
0
def when_i_update_the_notify_rule_with_group1_group2_and_group3(step, new_name, new_body, new_mail, server_id):

    if new_name == RANDOM:
        world.rule_name = Utils.id_generator()
    else:
        world.rule_name = new_name
    world.server_id = server_id

    world.rule_action = Rule_Utils.create_rule_action_dict(action_name='notify-email', body=new_body, email=new_mail)

    world.req = api_utils.update_rule(tenant_id=world.tenant_id, server_id=world.server_id, rule_name=world.rule_name,
                                      cpu=world.cpu, mem=world.mem, action=world.rule_action, headers=world.headers,
                                      rule_id=world.rule_id)
コード例 #15
0
ファイル: subscriptions.py プロジェクト: cgc951/fiware-cloto
def new_subscription_in_server(context, server_id, url_to_notify):

    context.url_to_notify = url_to_notify
    if server_id == RANDOM:
        context.server_id = Utils.id_generator(10)
    else:
        context.server_id = server_id

    context.req = api_utils.create_subscription(tenant_id=context.tenant_id,
                                                server_id=context.server_id,
                                                rule_id=context.rule_id,
                                                url=context.url_to_notify,
                                                headers=context.headers)
コード例 #16
0
def retrieve_subscription(step, server_id):

    if server_id == RANDOM:
        world.server_id = Utils.id_generator(10)
    else:
        world.server_id = server_id

    world.req = api_utils.retrieve_subscription(
        tenant_id=world.tenant_id,
        server_id=world.server_id,
        subscription_id=world.subscription_id,
        headers=world.headers,
    )
コード例 #17
0
def new_subscription_in_server(step, server_id, url_to_notify):

    world.url_to_notify = url_to_notify
    if server_id == RANDOM:
        world.server_id = Utils.id_generator(10)
    else:
        world.server_id = server_id

    world.req = api_utils.create_subscription(tenant_id=world.tenant_id,
                                              server_id=world.server_id,
                                              rule_id=world.rule_id,
                                              url=world.url_to_notify,
                                              headers=world.headers)
コード例 #18
0
ファイル: rules.py プロジェクト: Fiware/cloud.Cloto
def when_i_update_the_notify_rule_with_group1_group2_and_group3(context, new_name, new_body, new_mail, server_id):

    if new_name == RANDOM:
        context.rule_name = Utils.id_generator()
    else:
        context.rule_name = new_name
    context.server_id = server_id

    context.rule_action = Rule_Utils.create_rule_action_dict(action_name='notify-email', body=new_body, email=new_mail)

    context.req = api_utils.update_rule(tenant_id=context.tenant_id, server_id=context.server_id,
                                        rule_name=context.rule_name, cpu=context.cpu, mem=context.mem,
                                        hdd=context.hdd, net=context.net, action=context.rule_action,
                                        headers=context.headers, rule_id=context.rule_id)
コード例 #19
0
ファイル: rules.py プロジェクト: carloslucenah/fiware-cloto
def when_i_update_the_rule_with_group1_and_group2(step, new_name, new_action, server_id):

    if new_name == 'random':
        world.rule_name = Utils.id_generator()
    else:
        world.rule_name = new_name

    world.server_id = server_id

    world.rule_action = Rule_Utils.create_rule_action_dict(action_name='notify-scale', operation=new_action)

    world.req = api_utils.update_rule(tenant_id=world.tenant_id, server_id=world.server_id, rule_name=world.rule_name,
                                      cpu=world.cpu, mem=world.mem, hdd=world.hdd, net=world.net,
                                      action=world.rule_action, headers=world.headers, rule_id=world.rule_id)
コード例 #20
0
def when_i_update_the_rule_with_group1_and_group2(step, new_name, new_action, server_id):

    if new_name == 'random':
        world.rule_name = Utils.id_generator()
    else:
        world.rule_name = new_name

    world.server_id = server_id

    world.rule_action = Rule_Utils.create_rule_action_dict(action_name='notify-scale', operation=new_action)

    world.req = api_utils.update_rule(tenant_id=world.tenant_id, server_id=world.server_id, rule_name=world.rule_name,
                                      cpu=world.cpu, mem=world.mem, action=world.rule_action, headers=world.headers,
                                      rule_id=world.rule_id)
コード例 #21
0
def new_subscription_in_server(step, server_id, url_to_notify):

    world.url_to_notify = url_to_notify
    if server_id == RANDOM:
        world.server_id = Utils.id_generator(10)
    else:
        world.server_id = server_id

    world.req = api_utils.create_subscription(
        tenant_id=world.tenant_id,
        server_id=world.server_id,
        rule_id=world.rule_id,
        url=world.url_to_notify,
        headers=world.headers,
    )
コード例 #22
0
ファイル: rules.py プロジェクト: Fiware/cloud.Cloto
def when_i_update_the_rule_with_group1_and_group2(context, new_name, new_action, server_id):

    if new_name == 'random':
        context.rule_name = Utils.id_generator()
    else:
        context.rule_name = new_name

    context.server_id = server_id

    context.rule_action = Rule_Utils.create_rule_action_dict(action_name='notify-scale', operation=new_action)

    context.req = api_utils.update_rule(tenant_id=context.tenant_id, server_id=context.server_id,
                                        rule_name=context.rule_name, cpu=context.cpu, mem=context.mem,
                                        hdd=context.hdd, net=context.net, action=context.rule_action,
                                        headers=context.headers, rule_id=context.rule_id)
コード例 #23
0
def when_i_create_a_scale_rule_with_group1_and_group2(context, rule_name,
                                                      action):

    if rule_name == 'random':
        rule_name = Utils.id_generator()

    action = Rule_Utils.create_rule_action_dict(action_name='notify-scale',
                                                operation=action)

    context.req = api_utils.create_rule(tenant_id=context.tenant_id,
                                        server_id=context.server_id,
                                        rule_name=rule_name,
                                        cpu=context.cpu,
                                        mem=context.mem,
                                        hdd=context.hdd,
                                        net=context.net,
                                        action=action,
                                        headers=context.headers)
コード例 #24
0
ファイル: rules.py プロジェクト: carloslucenah/fiware-cloto
def given_a_group1_of_servers_in_a_tenant(step, number_servers):

    world.number_servers = int(number_servers)
    world.servers_body = []

    for x in range(world.number_servers):
        world.rules = []
        server_id = Utils.id_generator(size=6)
        number_rules = random.randint(1, 5)

        for rule in range(number_rules):
            rule_body = Rule_Utils.create_scale_specific_rule()
            req = api_utils.create_rule(world.tenant_id, server_id, body=rule_body)
            assert_true(req.ok, HTTP_CODE_NOT_OK.format(req.status_code, req.content))
            rule_id = req.json()[RULE_ID]
            world.rules.append(Rule_Utils.create_rule_body(action=None, rule_id=rule_id, condition=None,
                                                           name=rule_body['name']))

        server_dict = {SERVER_ID: server_id,
                       RULES: world.rules}
        world.servers_body.append(server_dict)
コード例 #25
0
def when_i_update_the_notify_rule_with_group1_group2_and_group3(
        context, new_name, new_body, new_mail, server_id):

    if new_name == RANDOM:
        context.rule_name = Utils.id_generator()
    else:
        context.rule_name = new_name
    context.server_id = server_id

    context.rule_action = Rule_Utils.create_rule_action_dict(
        action_name='notify-email', body=new_body, email=new_mail)

    context.req = api_utils.update_rule(tenant_id=context.tenant_id,
                                        server_id=context.server_id,
                                        rule_name=context.rule_name,
                                        cpu=context.cpu,
                                        mem=context.mem,
                                        hdd=context.hdd,
                                        net=context.net,
                                        action=context.rule_action,
                                        headers=context.headers,
                                        rule_id=context.rule_id)
コード例 #26
0
def when_i_update_the_rule_with_group1_and_group2(context, new_name,
                                                  new_action, server_id):

    if new_name == 'random':
        context.rule_name = Utils.id_generator()
    else:
        context.rule_name = new_name

    context.server_id = server_id

    context.rule_action = Rule_Utils.create_rule_action_dict(
        action_name='notify-scale', operation=new_action)

    context.req = api_utils.update_rule(tenant_id=context.tenant_id,
                                        server_id=context.server_id,
                                        rule_name=context.rule_name,
                                        cpu=context.cpu,
                                        mem=context.mem,
                                        hdd=context.hdd,
                                        net=context.net,
                                        action=context.rule_action,
                                        headers=context.headers,
                                        rule_id=context.rule_id)
コード例 #27
0
ファイル: subscriptions.py プロジェクト: Fiware/cloud.Cloto
def retrieve_non_existent_subscription(context, server_id):

    context.server_id = server_id
    context.req = api_utils.retrieve_subscription(tenant_id=context.tenant_id, server_id=context.server_id,
                                                  subscription_id=Utils.id_generator(10), headers=context.headers)