Beispiel #1
0
def test_match_uri_requires_absolute_uri(site_root):
    with pytest.raises(Exception):
        app = get_mock_app()
        app.config.set('site/root', site_root.rstrip('/') + '/')
        config = {'url': '/%path:slug%', 'source': 'blah'}
        route = Route(app, config)
        route.matchUri('notabsuri')
Beispiel #2
0
def test_match_uri_requires_absolute_uri(site_root):
    with pytest.raises(Exception):
        app = get_mock_app()
        app.config.set('site/root', site_root.rstrip('/') + '/')
        config = {'url': '/%path:slug%', 'source': 'blah'}
        route = Route(app, config)
        route.matchUri('notabsuri')
Beispiel #3
0
def test_match_uri(site_root, config, uri, expected_match):
    site_root = site_root.rstrip('/') + '/'
    app = get_mock_app()
    app.config.set('site/root', site_root)
    config.setdefault('source', 'blah')
    route = Route(app, config)
    assert route.uri_pattern == config['url'].lstrip('/')
    m = route.matchUri(site_root + uri)
    assert m == expected_match
Beispiel #4
0
def test_match_uri(site_root, config, uri, expected_match):
    site_root = site_root.rstrip('/') + '/'
    app = get_mock_app()
    app.config.set('site/root', site_root)
    config.setdefault('source', 'blah')
    route = Route(app, config)
    assert route.uri_pattern == config['url'].lstrip('/')
    m = route.matchUri(site_root + uri)
    assert m == expected_match
def test_match_uri(site_root, config, params, uri, expected_match):
    site_root = site_root.rstrip('/') + '/'
    app = get_mock_app()
    app.config.set('site/root', urllib.parse.quote(site_root))
    app.sources = [_getMockSource('blah', params)]

    config.setdefault('source', 'blah')
    route = Route(app, config)
    assert route.uri_pattern == config['url'].lstrip('/')
    m = route.matchUri(urllib.parse.quote(site_root) + uri)
    assert m == expected_match
Beispiel #6
0
def test_match_uri(site_root, config, params, uri, expected_match):
    site_root = site_root.rstrip('/') + '/'
    app = get_mock_app()
    app.config.set('site/root', urllib.parse.quote(site_root))
    app.sources = [_getMockSource('blah', params)]

    config.setdefault('source', 'blah')
    route = Route(app, config)
    assert route.uri_pattern == config['url'].lstrip('/')
    m = route.matchUri(urllib.parse.quote(site_root) + uri)
    assert m == expected_match