mirror of https://github.com/logos-co/open-law.git
19 lines
624 B
Python
19 lines
624 B
Python
|
from flask.testing import FlaskCliRunner
|
||
|
from app.controllers import create_breadcrumbs
|
||
|
from app import models as m, db
|
||
|
|
||
|
|
||
|
def test_breadcrumbs(runner: FlaskCliRunner, app):
|
||
|
runner.invoke(args=["db-populate"])
|
||
|
with app.app_context(), app.test_request_context():
|
||
|
res = create_breadcrumbs(1, (1,), 1)
|
||
|
assert len(res) == 4
|
||
|
book: m.Book = db.session.get(m.Book, 1)
|
||
|
assert book
|
||
|
assert book.owner.username in res[0].label
|
||
|
assert res[1].label == book.label
|
||
|
with app.app_context(), app.test_request_context():
|
||
|
res = create_breadcrumbs(1, (), 1)
|
||
|
assert res
|
||
|
assert len(res) == 2
|