mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-04 19:14:23 +00:00
fix tests
This commit is contained in:
parent
7a885f11dd
commit
2524b34f09
@ -8,7 +8,7 @@ class Collection(BaseModel):
|
||||
# need to redeclare id to use it in the parrent relationship
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
label = db.Column(db.String(1024), unique=False, nullable=False)
|
||||
about = db.Column(db.Text, unique=False, nullable=False)
|
||||
about = db.Column(db.Text, unique=False, nullable=True)
|
||||
is_root = db.Column(db.Boolean, default=False)
|
||||
is_leaf = db.Column(db.Boolean, default=False)
|
||||
|
||||
|
@ -351,7 +351,7 @@ def collection_create(book_id: int):
|
||||
if form.validate_on_submit():
|
||||
label = form.label.data
|
||||
collection: m.Collection = m.Collection.query.filter_by(
|
||||
is_deleted=False, label=label, version_id=book.versions[-1]
|
||||
is_deleted=False, label=label, version_id=book.versions[-1].id
|
||||
).first()
|
||||
|
||||
if collection:
|
||||
@ -408,7 +408,7 @@ def collection_edit(book_id: int, collection_id: int):
|
||||
label = form.label.data
|
||||
|
||||
if (
|
||||
m.Collection.query.filter_by(label=label, version_id=book.versions[-1])
|
||||
m.Collection.query.filter_by(label=label, version_id=book.versions[-1].id)
|
||||
.filter(m.Collection.id != collection_id)
|
||||
.first()
|
||||
):
|
||||
|
@ -218,11 +218,14 @@ def test_crud_collection(client: FlaskClient, runner: FlaskCliRunner):
|
||||
collection: m.Collection = m.Collection.query.filter_by(
|
||||
label="Test Collection #1 Label"
|
||||
).first()
|
||||
m.Collection(
|
||||
label="Test Collection #2 Label", version_id=collection.version_id
|
||||
).save()
|
||||
|
||||
response: Response = client.post(
|
||||
f"/book/{book.id}/{collection.id}/edit",
|
||||
data=dict(
|
||||
label="Test Collection #1 Label",
|
||||
label="Test Collection #2 Label",
|
||||
),
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user