예제 #1
0
def test_safe_join_unsafe():
    with pytest.raises(NotFound):
        safe_join('/static', '/foo/bar')
        safe_join('/static', '//foo/bar')
        safe_join('/static', '../etc/passwords')
        safe_join('/static', 'foo/../../etc/passwords')
예제 #2
0
def test_safe_join_unsafe():
    with pytest.raises(NotFound):
        safe_join('/static', '/foo/bar')
        safe_join('/static', '//foo/bar')
        safe_join('/static', '../etc/passwords')
        safe_join('/static', 'foo/../../etc/passwords')
예제 #3
0
def test_safe_join_safe():
    assert safe_join('', '') == '.'
    assert safe_join('/static', 'foo/') == '/static/foo'
    assert safe_join('/static', 'foo/bar') == '/static/foo/bar'
    assert safe_join('/static/', 'foo/bar') == '/static/foo/bar'
예제 #4
0
def test_safe_join_safe():
    assert safe_join('', '') == '.'
    assert safe_join('/static', 'foo/') == '/static/foo'
    assert safe_join('/static', 'foo/bar') == '/static/foo/bar'
    assert safe_join('/static/', 'foo/bar') == '/static/foo/bar'