25 lines
724 B
Python
25 lines
724 B
Python
import os
|
|
from flask import Flask, render_template
|
|
from photoflow.ui import TEMPLATE_DIR, STATIC_DIR, register_shared_ui
|
|
|
|
|
|
def test_dirs_exist():
|
|
assert os.path.isfile(os.path.join(TEMPLATE_DIR, "base.html"))
|
|
assert os.path.isfile(os.path.join(STATIC_DIR, "shared.js"))
|
|
|
|
|
|
def test_register_serves_shared_static_and_template():
|
|
app = Flask(__name__)
|
|
register_shared_ui(app)
|
|
|
|
@app.route("/page")
|
|
def page():
|
|
return render_template("base.html")
|
|
|
|
client = app.test_client()
|
|
r = client.get("/page")
|
|
assert r.status_code == 200
|
|
assert b"/shared-static/shared.js" in r.data
|
|
js = client.get("/shared-static/shared.js")
|
|
assert js.status_code == 200 and b"photoGrid" in js.data
|