예제 #1
0
def test_static_url_no_filename(app):
    with app.test_request_context():
        app.preprocess_request()
        try:
            static_url()
            assert False, "static_url without a filename should throw an error"
        except werkzeug.routing.BuildError:
            pass
예제 #2
0
def test_static_url_no_filename(app):
    with app.test_request_context():
        app.preprocess_request()
        try:
            static_url()
            assert False, "static_url without a filename should throw an error"
        except werkzeug.routing.BuildError:
            pass
예제 #3
0
def test_static_url(app) -> None:
    """Static URLs have the mtime appended."""
    filename = "app.js"
    with app.test_request_context():
        app.preprocess_request()
        url = static_url(filename)
    assert url.startswith("/static/" + filename)
    assert "?mtime=" in url
예제 #4
0
def test_static_url(app, filename, has_modified):
    with app.test_request_context():
        app.preprocess_request()
        url = static_url(filename=filename)
    assert url.startswith('/static/' + filename)
    assert ('?mtime=' in url) == has_modified
예제 #5
0
def test_static_url(app, filename, has_modified):
    with app.test_request_context():
        app.preprocess_request()
        url = static_url(filename=filename)
    assert url.startswith('/static/' + filename)
    assert ('?mtime=' in url) == has_modified
예제 #6
0
def test_static_url(app: Flask) -> None:
    """Static URLs have the mtime appended."""
    with app.test_request_context():
        app.preprocess_request()
        url = static_url("app.js")
    assert url.startswith("/static/app.js?mtime=")