Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 9
0
def test_no_params():
    url = make_url("http://www.naprulez.org/")
    assert url == "http://www.naprulez.org/"
Exemplo n.º 10
0
def test_url():
    url = make_url("http://www.naprulez.org/", params={'x': '1'})
    assert url == "http://www.naprulez.org/?x=1"
Exemplo n.º 11
0
def test_no_params():
    url = make_url("http://www.naprulez.org/")
    assert url == "http://www.naprulez.org/"
Exemplo n.º 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"
Exemplo n.º 13
0
def test_no_params():
    url = make_url("http://www.google.com/")
    assert url == "http://www.google.com/"
Exemplo n.º 14
0
def test_url():
    url = make_url("http://www.google.com/", params={'x': '1'})
    assert url == "http://www.google.com/?x=1"
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 17
0
def test_url():
    url = make_url("http://www.naprulez.org/", params={'x': '1'})
    assert url == "http://www.naprulez.org/?x=1"