コード例 #1
0
def test_incorrect_uri_construction_illegal_slash_folder_char(uparts):
    uparts['folder'] = 'spam/ham'
    with pytest.raises(session.InvalidInstanceNameOrFolder) as II:
        session.generate_bigip_uri(**uparts)
    test_value = "instance names and folders cannot contain '/', but it's: %s"\
                 % uparts['folder']
    assert II.value.message == test_value
コード例 #2
0
def test_incorrect_uri_construction_illegal_tilde_partition_char(uparts):
    uparts['partition'] = 'spam~ham'
    with pytest.raises(session.InvalidInstanceNameOrFolder) as II:
        session.generate_bigip_uri(**uparts)
    test_value = "instance names and partitions cannot contain '~', but" +\
        " it's: %s" % uparts['partition']
    assert II.value.message == test_value
コード例 #3
0
def test_incorrect_uri_construction_illegal_suffix_nonslash_first(uparts):
    uparts['suffix'] = 'ham'
    with pytest.raises(session.InvalidSuffixCollection) as II:
        session.generate_bigip_uri(**uparts)
    test_value = "suffix_collections path element must start with '/', but " +\
                 "it's: %s" % uparts['suffix']
    assert II.value.message == test_value
コード例 #4
0
def test_incorrect_uri_construction_bad_base_nonslash_last(uparts):
    uparts['base_uri'] = 'https://0.0.0.0/mgmt/tm/root/RESTiface'
    with pytest.raises(session.InvalidPrefixCollection) as IR:
        session.generate_bigip_uri(**uparts)
    test_value = "prefix_collections path element must end with '/', but" +\
        " it's: root/RESTiface"
    assert IR.value.message == test_value
コード例 #5
0
def test_incorrect_uri_construction_illegal_tilde_partition_char(uparts):
    uparts['partition'] = 'spam~ham'
    with pytest.raises(session.InvalidInstanceNameOrFolder) as II:
        session.generate_bigip_uri(**uparts)
    test_value = "instance names and partitions cannot contain '~', but" +\
        " it's: %s" % uparts['partition']
    assert II.value.message == test_value
コード例 #6
0
def test_incorrect_uri_construction_illegal_suffix_nonslash_first(uparts):
    uparts['suffix'] = 'ham'
    with pytest.raises(session.InvalidSuffixCollection) as II:
        session.generate_bigip_uri(**uparts)
    test_value = "suffix_collections path element must start with '/', but " +\
                 "it's: %s" % uparts['suffix']
    assert II.value.message == test_value
コード例 #7
0
def test_incorrect_uri_construction_bad_base_nonslash_last(uparts):
    uparts['base_uri'] = 'https://0.0.0.0/mgmt/tm/root/RESTiface'
    with pytest.raises(session.InvalidPrefixCollection) as IR:
        session.generate_bigip_uri(**uparts)
    test_value = "prefix_collections path element must end with '/', but" +\
        " it's: root/RESTiface"
    assert IR.value.message == test_value
コード例 #8
0
def test_incorrect_uri_construction_bad_mgmt_path(uparts):
    uparts['base_uri'] = 'https://0.0.0.0/magmt/tm/root/RESTiface'
    with pytest.raises(session.InvalidBigIP_ICRURI) as IR:
        session.generate_bigip_uri(**uparts)
    assert IR.value.message ==\
        "The path must start with '/mgmt/tm/'!!  But it's: '/magmt/tm/'"
コード例 #9
0
def test_incorrect_uri_construction_bad_scheme(uparts):
    uparts['base_uri'] = 'hryttps://0.0.0.0/mgmt/tm/root/RESTiface/'
    with pytest.raises(session.InvalidScheme) as IS:
        session.generate_bigip_uri(**uparts)
    assert IS.value.message == 'hryttps'
コード例 #10
0
def test_correct_uri_construction_nameless_and_suffixless(uparts):
    uparts['name'] = ''
    uparts['suffix'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == 'https://0.0.0.0/mgmt/tm/root/RESTiface/~BIGCUSTOMER'
コード例 #11
0
def test_correct_uri_construction_partitionless_and_suffixless(uparts):
    uparts['partition'] = ''
    uparts['suffix'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == 'https://0.0.0.0/mgmt/tm/root/RESTiface/~foobar1'
コード例 #12
0
def test_correct_uri_construction_partitionless_and_nameless(uparts):
    uparts['partition'] = ''
    uparts['name'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == "https://0.0.0.0/mgmt/tm/root/RESTiface/members/m1"
コード例 #13
0
def test_correct_uri_construction_partitionless_and_nameless(uparts):
    uparts['partition'] = ''
    uparts['name'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == "https://0.0.0.0/mgmt/tm/root/RESTiface/members/m1"
コード例 #14
0
def test_correct_uri_construction_folder_name_and_suffixless(uparts):
    uparts['folder'] = ''
    uparts['instance_name'] = ''
    uparts['suffix'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == "https://0.0.0.0/mgmt/tm/root/RESTiface/"
コード例 #15
0
def test_incorrect_uri_construction_bad_mgmt_path(uparts):
    uparts['base_uri'] = 'https://0.0.0.0/magmt/tm/root/RESTiface'
    with pytest.raises(session.InvalidBigIP_ICRURI) as IR:
        session.generate_bigip_uri(**uparts)
    assert IR.value.message ==\
        "The path must start with '/mgmt/tm/'!!  But it's: '/magmt/tm/'"
コード例 #16
0
def test_incorrect_uri_construction_bad_scheme(uparts):
    uparts['base_uri'] = 'hryttps://0.0.0.0/mgmt/tm/root/RESTiface/'
    with pytest.raises(session.InvalidScheme) as IS:
        session.generate_bigip_uri(**uparts)
    assert IS.value.message == 'hryttps'
コード例 #17
0
def test_correct_uri_construction_nameless_and_suffixless(uparts):
    uparts['name'] = ''
    uparts['suffix'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == 'https://0.0.0.0/mgmt/tm/root/RESTiface/~BIGCUSTOMER'
コード例 #18
0
def test_correct_uri_construction_partitionless_and_suffixless(uparts):
    uparts['partition'] = ''
    uparts['suffix'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == 'https://0.0.0.0/mgmt/tm/root/RESTiface/foobar1'
コード例 #19
0
def test_correct_uri_construction_nameless(uparts):
    uparts['name'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri ==\
        "https://0.0.0.0/mgmt/tm/root/RESTiface/~BIGCUSTOMER/members/m1"
コード例 #20
0
def test_correct_uri_construction_folderless(uparts):
    uparts['folder'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri == 'https://0.0.0.0/mgmt/tm/root/RESTiface/~foobar1/members/m1'
コード例 #21
0
def test_correct_uri_construction_nameless(uparts):
    uparts['name'] = ''
    uri = session.generate_bigip_uri(**uparts)
    assert uri ==\
        "https://0.0.0.0/mgmt/tm/root/RESTiface/~BIGCUSTOMER/members/m1"