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
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
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
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
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/'"
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'
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'
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'
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"
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/"
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'
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"
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'