Beispiel #1
0
def test_url_is_normalized():
    base_url = "https://example.com/path/"
    params = {'two': [3, 2], 'one': 1}
    expected_normalized_url = "https://example.com/path/?one=1&two=3&two=2"

    actual_normalized_url = make_url(base_url, params)
    assert actual_normalized_url == expected_normalized_url
Beispiel #2
0
def test_partial_url_is_normalized():
    base_url = "https://foo.bar.example.com"
    params = {}
    expected_normalized_url = "https://foo.bar.example.com"

    actual_normalized_url = make_url(base_url, params)
    assert actual_normalized_url == expected_normalized_url
Beispiel #3
0
def test_url_is_normalized():
    base_url = "https://example.com/path/"
    params = {'two': [3, 2], 'one': 1}
    expected_normalized_url = "https://example.com/path/?one=1&two=3&two=2"

    actual_normalized_url = make_url(base_url, params)
    assert actual_normalized_url == expected_normalized_url
Beispiel #4
0
def test_partial_url_is_normalized():
    base_url = "https://foo.bar.example.com"
    params = {}
    expected_normalized_url = "https://foo.bar.example.com"

    actual_normalized_url = make_url(base_url, params)
    assert actual_normalized_url == expected_normalized_url
Beispiel #5
0
def test_add_slash():
    url = "http://www.naprulez.org"
    assert make_url(url, add_slash=True) == "http://www.naprulez.org/"
    assert make_url(url, add_slash=False) == "http://www.naprulez.org"
    assert make_url(url, params={'x': 1}) == "http://www.naprulez.org?x=1"

    url_s = "http://www.naprulez.org/"
    assert make_url(url_s, add_slash=True) == "http://www.naprulez.org/"
    assert make_url(url_s, add_slash=False) == "http://www.naprulez.org"
    assert make_url(url_s, params={'x': 1}) == "http://www.naprulez.org/?x=1"
Beispiel #6
0
def test_add_slash():
    url = "http://www.naprulez.org"
    assert make_url(url, add_slash=True) == "http://www.naprulez.org/"
    assert make_url(url, add_slash=False) == "http://www.naprulez.org"
    assert make_url(url, params={'x': 1}) == "http://www.naprulez.org?x=1"

    url_s = "http://www.naprulez.org/"
    assert make_url(url_s, add_slash=True) == "http://www.naprulez.org/"
    assert make_url(url_s, add_slash=False) == "http://www.naprulez.org"
    assert make_url(url_s, params={'x': 1}) == "http://www.naprulez.org/?x=1"
Beispiel #7
0
def test_add_slash():
    url = "http://www.google.com"
    assert make_url(url, add_slash=True) == "http://www.google.com/"
    assert make_url(url, add_slash=False) == "http://www.google.com"
    assert make_url(url, params={'x': 1}) == "http://www.google.com?x=1"

    url_s = "http://www.google.com/"
    assert make_url(url_s, add_slash=True) == "http://www.google.com/"
    assert make_url(url_s, add_slash=False) == "http://www.google.com"
    assert make_url(url_s, params={'x': 1}) == "http://www.google.com/?x=1"
Beispiel #8
0
def test_multiple_params():
    url = make_url("http://www.naprulez.org/", params={'x': ['1', '2']})
    assert url == "http://www.naprulez.org/?x=1&x=2"
Beispiel #9
0
def test_no_params():
    url = make_url("http://www.naprulez.org/")
    assert url == "http://www.naprulez.org/"
Beispiel #10
0
def test_url():
    url = make_url("http://www.naprulez.org/", params={'x': '1'})
    assert url == "http://www.naprulez.org/?x=1"
Beispiel #11
0
def test_no_params():
    url = make_url("http://www.naprulez.org/")
    assert url == "http://www.naprulez.org/"
Beispiel #12
0
def test_multiple_params():
    url = make_url("http://www.naprulez.org/", params={'x': ['1', '2']})
    assert url == "http://www.naprulez.org/?x=1&x=2"
Beispiel #13
0
def test_no_params():
    url = make_url("http://www.google.com/")
    assert url == "http://www.google.com/"
Beispiel #14
0
def test_url():
    url = make_url("http://www.google.com/", params={'x': '1'})
    assert url == "http://www.google.com/?x=1"
Beispiel #15
0
def test_unicode():
    url = make_url("http://www.naprulez.org/", params={'x': u'\u0414'})
    assert url == "http://www.naprulez.org/?x=%D0%94"
Beispiel #16
0
def test_unicode():
    url = make_url("http://www.naprulez.org/", params={'x': u'\u0414'})
    assert url == "http://www.naprulez.org/?x=%D0%94"
Beispiel #17
0
def test_url():
    url = make_url("http://www.naprulez.org/", params={'x': '1'})
    assert url == "http://www.naprulez.org/?x=1"