Beispiel #1
0
def test_valid(url_before, excluded):
    url_after = validate_url(url_before, excluded)
    print()
    print("URL Before: " + str(url_before))
    print("URL After:  " + str(url_after))
    print("Excluded: " + str(excluded))
    params_before = get_params(url_before)
    params_after = get_params(url_after)

    #expected parameters
    params_expected = get_expected_params(params_before, excluded)
    assert (params_after == params_expected)

    #domains
    domains_before = get_domains(url_before)
    domains_after = get_domains(url_after)

    #ensure top-level domain is .gov
    assert (domains_after.group('top').lower() == '.gov')

    #ensure low-level domains have NOT been changed
    assert (domains_after.group('lower') == domains_before.group('lower'))
Beispiel #2
0
def test_identity():
    assert validate_url("www.austintexas.gov") == "www.austintexas.gov"
Beispiel #3
0
def test_Empty2ndArgument_13():
    assert validate_url(
        "www.austintexas.gov?a=1&b=1', []") == "www.austintexas.gov?a=1&b=1"
Beispiel #4
0
def test_ParamValueCharEqualsChar_11():
    assert validate_url(
        "www.austintexas.gov?a=1&b=b") == "www.austintexas.gov?a=1&b=b"
Beispiel #5
0
def test_MissingValue2ndArgument_12():
    assert validate_url(
        "www.austintexas.gov?a=1&b=', [b]") == "www.austintexas.gov?a=1"
Beispiel #6
0
def test_VerifyInvalidURL_8():
    assert validate_url("www.austintexas,com") == "www.austintexas.gov"
Beispiel #7
0
def test_2ndInValidArgument_10():
    assert validate_url(
        "www.austintexas.gov?a=1&b=2', ['b']") == "www.austintexas.gov?a=1&b=2"
Beispiel #8
0
def test_invalidURL_6():
    assert validate_url("ww.austintexas.gov?a=1") == "www.austintexas.gov?a=1"
Beispiel #9
0
def test_validURL_positiveVerify_withSpecialChar_7():
    assert validate_url("www.austintexas.com?") == "www.austintexas.gov"
Beispiel #10
0
def test_validURL_noFirstParamValue_4():
    assert validate_url(
        "www.austintexas.gov?a=&b=6") == "www.austintexas.gov?b=6"
Beispiel #11
0
def test_validURL_missingSecondParam_5():
    assert validate_url(
        "www.austintexas.gov?a=1&") == "www.austintexas.gov?a=1"
Beispiel #12
0
def test_validURL_withParamValueAnd2Equals_3():
    assert validate_url(
        "www.austintexas.gov?a==1&b=2") == "www.austintexas.gov?a=1&b=2"
Beispiel #13
0
def test_validURL_withANDkeyword_2():
    assert validate_url(
        "www.austintexas.gov?a=1&b=2andb=2") == "www.austintexas.gov?a=1&b=2"
Beispiel #14
0
def test_validURL_positiveVerify_1():
    assert validate_url(
        "www.austintexas.gov?a=1&b=2&b=2") == "www.austintexas.gov?a=1&b=2"
Beispiel #15
0
def test_validURL_withAll3ValidationRule_0():
    assert validate_url("www.austintexas.com?a=1&b=2&b=2',['b']"
                        ) == "www.austintexas.gov?a=1&b=2"
Beispiel #16
0
def test_ArgumentwithmissingString_14():
    assert validate_url(
        "www.austintexas.gov?a=1&b=1', [b]") == "www.austintexas.gov?a=1&b=1"