mirror of https://github.com/logos-co/open-law.git
fix breadcrumbs tests
This commit is contained in:
parent
ba860fe59d
commit
1bdf045adc
|
@ -17,8 +17,6 @@ from tests.utils import (
|
|||
create_collection,
|
||||
create_section,
|
||||
create_sub_collection,
|
||||
create_interpretation,
|
||||
create_comment,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
from flask.testing import FlaskCliRunner
|
||||
from app.controllers import create_breadcrumbs
|
||||
from app import models as m, db
|
||||
from tests.utils import create_book, login, create_collection, create_section
|
||||
|
||||
|
||||
def test_breadcrumbs(runner: FlaskCliRunner, app):
|
||||
runner.invoke(args=["db-populate"])
|
||||
def test_breadcrumbs(client, app):
|
||||
login(client)
|
||||
book = create_book(client)
|
||||
collection, _ = create_collection(client, book.id)
|
||||
section, _ = create_section(client, book.id, collection.id)
|
||||
with app.app_context(), app.test_request_context():
|
||||
res = create_breadcrumbs(book_id=1, collection_id=1, section_id=1)
|
||||
res = create_breadcrumbs(
|
||||
book_id=book.id, collection_id=collection.id, section_id=section.id
|
||||
)
|
||||
assert len(res) == 4
|
||||
book: m.Book = db.session.get(m.Book, 1)
|
||||
assert book
|
||||
|
|
Loading…
Reference in New Issue