예제 #1
0
def test_vrrp_list():
    client = make_client(return_value=answers.VRRP_LIST)
    args = ['vrrp list']

    output = run_cmd(args, client, json_output=True)

    assert len(output) == 2
def test_update_theme():
    client = make_client(return_value=answers.CUSTOMIZATION_UPDATE)
    args = ['customization update', '--color', '00eeff']

    output = run_cmd(args, client, json_output=True)

    assert output["color"] == "00eeff"
예제 #3
0
def test_subnet_show():
    client = make_client(return_value=answers.SUBNET_SHOW)
    args = ['subnet show', '6145fba6-dbe2-47af-bad2-6d1dcese5996']

    output = run_cmd(args, client, json_output=True)

    assert output["id"] == 420
def test_cross_region_subnet_list():
    client = make_client(return_value=answers.CROSS_REGION_SUBNETS_LIST)
    args = ['subnet cross-region list']

    output = run_cmd(args, client, json_output=True)

    assert len(output) == 2
예제 #5
0
def test_subnet_list_with_filters():
    client = make_client(return_value=answers.LICENSES_LIST)

    args = ['license list', "--project", "e7081cb46966421fb8b3f3fd9b4db75b"]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
    assert output[0]["project_id"] == 'e7081cb46966421fb8b3f3fd9b4db75b'

    args = ['license list', "--region", "ru-1"]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
    assert output[0]["project_id"] == 'e7081cb46966421fb8b3f3fd9b4db75b'

    args = ['license list',
            "--project", "e7081cb46966421fb8b3f3fd9b4db75b",
            "--region", "ru-1"]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
    assert output[0]["project_id"] == 'e7081cb46966421fb8b3f3fd9b4db75b'

    args = ['license list',
            "--project", "e7081cb46966421fb8b3f3fd9b4db75b",
            "--region", "ru-2"]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 0
예제 #6
0
def test_floatingip_list_with_filters():
    client = make_client(return_value=answers.FLOATINGIP_LIST)

    args = ['floatingip list', "--project", "a2e6dd715ca24681b9b335d247b83d16"]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
    assert output[0]["project_id"] == 'a2e6dd715ca24681b9b335d247b83d16'

    args = ['floatingip list', "--region", "ru-1"]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
    assert output[0]["project_id"] == 'a2e6dd715ca24681b9b335d247b83d16'

    args = [
        'floatingip list', "--project", "a2e6dd715ca24681b9b335d247b83d16",
        "--region", "ru-1"
    ]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
    assert output[0]["project_id"] == 'a2e6dd715ca24681b9b335d247b83d16'

    args = [
        'floatingip list', "--project", "a2e6dd715ca24681b9b335d247b83d16",
        "--region", "ru-2"
    ]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 0
예제 #7
0
def test_limit_show():
    client = make_client(return_value=answers.LIMITS_SHOW)
    args = ['limit show']

    output = run_cmd(args, client, json_output=True)

    assert len(output) == COUNT_OF_LIMITS
예제 #8
0
def test_keypair_delete_without_accept():
    client = make_client(return_value=None)
    args = ["keypair delete", "MOSCOW_KEY",
            "--user", "88ad5569d8c64f828ac3d2efa4e552dd"]

    with pytest.raises(SystemExit):
        run_cmd(args, client)
def test_cross_region_subnet_multiple_delete():
    client = make_client(return_value=None)
    args = [
        'subnet cross-region delete', '--yes-i-really-want-to-delete', '1', '2'
    ]

    run_cmd(args, client)
예제 #10
0
def test_token_create():
    client = make_client(return_value=answers.TOKENS_CREATE)
    args = ['token create', '--project', 'project_id_here']

    output = run_cmd(args, client, json_output=True)

    assert 'id' in output
    assert 'a9a81014462d499d9d55d3402991f224' in output['id']
예제 #11
0
def test_domain_token_create():
    client = make_client(return_value=answers.TOKENS_CREATE)
    args = ['token create', '--account', 'account_name']

    output = run_cmd(args, client, json_output=True)

    assert 'id' in output
    assert 'a9a81014462d499d9d55d3402991f224' in output['id']
예제 #12
0
def test_capabilities_show_traffic():
    count_of_granularities = 3
    client = make_client(return_value=answers.CAPABILITIES_LIST)
    args = ['capabilities show traffic']

    licenses = run_cmd(args, client, json_output=True)

    assert len(licenses) == count_of_granularities
예제 #13
0
def test_capabilities_show_resources():
    count_of_resources = 10
    client = make_client(return_value=answers.CAPABILITIES_LIST)
    args = ['capabilities show resources']

    licenses = run_cmd(args, client, json_output=True)

    assert len(licenses) == count_of_resources
예제 #14
0
def test_capabilities_show_regions():
    count_of_zones = 3
    client = make_client(return_value=answers.CAPABILITIES_LIST)
    args = ['capabilities show regions']

    regions = run_cmd(args, client, json_output=True)

    assert len(regions) == count_of_zones
예제 #15
0
def test_keypair_list():
    client = make_client(return_value=answers.KEYPAIR_LIST)

    args = ["keypair list"]

    output = run_cmd(args, client, json_output=True)

    assert len(output) == 2
예제 #16
0
def test_role_delete_without_accept():
    client = make_client(return_value=None)
    args = ['role delete',
            '-p 1_7354286c9ebf464d86efc16fb56d4fa3',
            '-u 5900efc62db34decae9f2dbc04a8ce0f']

    with pytest.raises(SystemExit):
        run_cmd(args, client)
예제 #17
0
def test_floatingip_show():
    client = make_client(return_value=answers.FLOATINGIP_SHOW)
    args = ['floatingip show', '5b3c296f-b8e2-4ef1-abe7-866b1d3503ca']

    output = run_cmd(args, client, json_output=True)

    assert output[0]["id"] == '0d987b46-bad5-41b7-97e3-bac9974aa97a'
    assert output[0]["project_id"] == 'a2e6dd715ca24681b9b335d247b83d16'
예제 #18
0
def test_vrrp_show():
    client = make_client(return_value=answers.VRRP_SHOW)
    args = ['vrrp show', '2']

    output = run_cmd(args, client, json_output=True)

    assert output[0]["id"] == 2
    assert output[0]["project_id"] == 'b63ab68796e34858befb8fa2a8b1e12a'
예제 #19
0
def test_floatingip_list():
    client = make_client(return_value=answers.FLOATINGIP_LIST)
    args = ['floatingip list']

    output = run_cmd(args, client, json_output=True)

    assert len(output) == 2
    assert output[0]["id"] == '0d987b46-bad5-41b7-97e3-bac9974aa97a'
예제 #20
0
def test_quota_list():
    count_of_quotas = 12
    client = make_client(return_value=answers.QUOTAS_LIST)
    args = ['quota list']

    output = run_cmd(args, client, json_output=True)

    assert len(output) == count_of_quotas
예제 #21
0
def test_floating_ips_particle_resp():
    client = make_client(return_value=answers.FLOATING_IPS_PARTIAL)
    args = [
        "floatingip add", "a2e6dd715ca24681b9b335d247b83d16", "-r", "ru-1",
        "--quantity", "1"
    ]
    output = run_cmd(args, client, json_output=True)
    assert output == answers.FLOATING_IPS_PARTIAL_RESULT
예제 #22
0
def test_licenses_multiple_delete():
    client = make_client(return_value=None)
    args = ["license delete",
            "--yes-i-really-want-to-delete",
            "15c578ea47a5466db2aeb57dc8443676",
            "1ec578ea47a5466db2aeb57dc8443672",
            "16c578ea47a5466db2aeb57dc8443676"]
    run_cmd(args, client)
예제 #23
0
def test_quota_show():
    count_of_quotas = len(answers.QUOTAS_SHOW['quotas'])
    client = make_client(return_value=answers.QUOTAS_SHOW)
    args = ['quota show', '30bde559615740d28bb63ee626fd0f25']

    output = run_cmd(args, client, json_output=True)

    assert len(output) == count_of_quotas
def test_cross_region_subnet_show():
    client = make_client(return_value=answers.CROSS_REGION_SUBNETS_SHOW)
    args = ['subnet cross-region show', '1']

    output = run_cmd(args, client, json_output=True)

    assert output[0]["id"] == 1
    assert output[0]["project_id"] == 'b63ab68796e34858befb8fa2a8b1e12a'
예제 #25
0
def test_quotas_partial_resp():
    client = make_client(return_value=answers.QUOTAS_PARTIAL)
    args = [
        'quota set', '30bde559615740d28bb63ee626fd0f25', '--resource',
        'image_gigabytes', '--region', 'ru-1', '--value', '400'
    ]
    output = run_cmd(args, client, json_output=True)
    assert len(output) == 1
def test_show_no_theme():
    client = make_client(return_value=answers.CUSTOMIZATION_NO_THEME)
    args = ['customization show']

    output = run_cmd(args, client, json_output=True)

    assert output["color"] == ""
    assert output["logo"] is False
예제 #27
0
def test_license_show():
    client = make_client(return_value=answers.LICENSES_SHOW)
    args = ['license show', '420']

    output = run_cmd(args, client, json_output=True)

    assert output["id"] == 420
    assert output["project_id"] == 'e7081cb46966421fb8b3f3fd9b4db75b'
def test_show_theme_b64():
    client = make_client(return_value=answers.CUSTOMIZATION_SHOW)
    args = ['customization show', '--show-base64']

    output = run_cmd(args, client, json_output=True)

    assert output["color"] == "00ffee"
    assert output["logo"] == params.LOGO_BASE64
예제 #29
0
def test_token_multiple_delete():
    client = make_client(return_value=None)
    args = [
        "token delete", "--yes-i-really-want-to-delete",
        "a9a81014462d499d9d55d3402991f224", "a9a81014462d499d9d55d3402991f225",
        "a9a81014462d499d9d55d3402991f226"
    ]
    run_cmd(args, client)
예제 #30
0
def test_licenses_partial_resp():
    client = make_client(return_value=answers.LICENSES_PARTIAL)
    args = ['license add',
            'e7081cb46966421fb8b3f3fd9b4db75b',
            '--region', 'ru-1',
            '--type', 'windows_server_license',
            '--quantity', '1']
    output = run_cmd(args, client, json_output=True)
    assert output == answers.LICENSES_PARTIAL_RESULT