def test_marshal_url_exceptions(target): with pytest.raises(ValueError) as excinfo: _marshal_uri( target_uri=urlparse(target), origin_uri=None, ) assert 'Invalid target: \'{target}\''.format(target=target) in str(excinfo.value)
def test_marshal_url(target, expected_marshaled_uri): origin_url = '/api_docs/swagger.json' marshaled_uri = _marshal_uri( target_uri=urlparse(target), origin_uri=urlparse(origin_url), ) assert marshaled_uri == expected_marshaled_uri
def test_marshal_url_no_origin_uri(target, expected_marshaled_uri): marshaled_uri = _marshal_uri( target_uri=urlparse(target), origin_uri=None, ) assert marshaled_uri == expected_marshaled_uri