Example #1
0
    def test_urljoin(self):
        for base, args, expected in [
            ("http://localhost", ["path1"], "http://localhost/path1"),
            ("http://localhost/path1", ["path2"], "http://localhost/path1/path2"),
            ("http://localhost", ["path1", "path2"], "http://localhost/path1/path2"),
            ("http://localhost?foo=bar", ["path1"], "http://localhost/path1?foo=bar"),
        ]:

            assert urljoin(base, *args) == expected
Example #2
0
def test_urljoin():
    data = [
        ('http://localhost', ['path1'], 'http://localhost/path1'),
        ('http://localhost/path1', ['path2'], 'http://localhost/path1/path2'),
        ('http://localhost', ['path1', 'path2'], 'http://localhost/path1/path2'),
        ('http://localhost?foo=bar', ['path1'], 'http://localhost/path1?foo=bar'),
    ]

    for base, args, expected in data:
        assert urljoin(base, *args) == expected
Example #3
0
def test_urljoin():
    data = [
        ('http://localhost', ['path1'], 'http://localhost/path1'),
        ('http://localhost/path1', ['path2'], 'http://localhost/path1/path2'),
        ('http://localhost', ['path1',
                              'path2'], 'http://localhost/path1/path2'),
        ('http://localhost?foo=bar', ['path1'],
         'http://localhost/path1?foo=bar'),
    ]

    for base, args, expected in data:
        assert urljoin(base, *args) == expected
Example #4
0
    def test_urljoin(self):
        for base, args, expected in [
            ('http://localhost', ['path1'],
             'http://localhost/path1'),

            ('http://localhost/path1', ['path2'],
             'http://localhost/path1/path2'),

            ('http://localhost', ['path1', 'path2'],
             'http://localhost/path1/path2'),

            ('http://localhost?foo=bar', ['path1'],
             'http://localhost/path1?foo=bar'),
            ]:

            eq_(urljoin(base, *args), expected)