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