Beispiel #1
0
def test_proxify_with_url(app):
    with app.test_client():
        app.config['IMGPROXY_URL'] = 'http://imgprx.com/{url}'
        app.config.pop('IMGPROXY_URL_PATTERN')
        app.config.pop('IMGPROXY_URL_VARIABLE')
        assert (proxify_filter('http://naver.com/foo.jpg') ==
                'http://imgprx.com/http://naver.com/foo.jpg')
Beispiel #2
0
def test_proxify_with_no_proxy(app):
    with app.test_client():
        app.config.pop('IMGPROXY_URL')
        app.config.pop('IMGPROXY_URL_PATTERN')
        app.config.pop('IMGPROXY_URL_VARIABLE')
        assert (proxify_filter('http://naver.com/foo.jpg') ==
                'http://naver.com/foo.jpg')
Beispiel #3
0
def test_proxify_with_pattern(app):
    with app.test_client():
        app.config['IMGPROXY_URL_PATTERN'] = 'http://imgprx.com/{v}/{url}'
        app.config['IMGPROXY_URL_VARIABLE'] = lambda url: 0
        assert (proxify_filter('http://naver.com/foo.jpg') ==
                'http://imgprx.com/0/http://naver.com/foo.jpg')