Ejemplo n.º 1
0
def custom_rewrite_rule(app):
    app.config[key('FORMATSTR')] = '/%(path)s-rev:%(rev)s%(ext)s'
    setup(app)
    with app.test_client() as c:
        rv = c.get('/static/js/app-rev:d41d8cd98f00.js')
        assert rv.status_code == 302
        assert rv.headers['Location'] == 'http://localhost/static/js/app.js'
Ejemplo n.º 2
0
def instance(app):
    _, rev = setup(app)
    assert app is not None
    assert app.jinja_env.filters[app.config[key('FILTER_NAME')]] is rev
Ejemplo n.º 3
0
def file_checksum_rev_init(app):
    setup(app)
    rev = FileChecksumRev(formatstr=app.config[key('FORMATSTR')],
                          rev_length=app.config[key('REV_LENGTH')],
                          root_path=app.root_path)
    assert rev('static/js/app.js') == '/static/js/app-1b42a11f5f64.js'
Ejemplo n.º 4
0
def existing_file_custom_formatstr(app):
    app.config[key('FORMATSTR')] = '/rev-%(rev)s/%(path)s%(ext)s'
    _, rev = setup(app)
    assert rev('static/js/app.js') == '/rev-1b42a11f5f64/static/js/app.js'