This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/util/test/test_util.py

21 lines
638 B
Python

import pytest
from util import slash_join
@pytest.mark.parametrize('pieces, expected', [
(['https://github.com', '/coreos-inc/' 'quay/pull/1092/files'],
'https://github.com/coreos-inc/quay/pull/1092/files'),
(['https://', 'github.com/', '/coreos-inc', '/quay/pull/1092/files/'],
'https://github.com/coreos-inc/quay/pull/1092/files'),
(['https://somegithub.com/', '/api/v3/'],
'https://somegithub.com/api/v3'),
(['https://github.somedomain.com/', '/api/v3/'],
'https://github.somedomain.com/api/v3'),
])
def test_slash_join(pieces, expected):
joined_url = slash_join(*pieces)
assert joined_url == expected