mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-04 02:56:35 +00:00
creating initial version
This commit is contained in:
parent
6cd10b7378
commit
627179102b
@ -37,8 +37,10 @@ def create():
|
||||
label=form.label.data,
|
||||
)
|
||||
log(log.INFO, "Form submitted. Book: [%s]", book)
|
||||
flash("Book added!", "success")
|
||||
book.save()
|
||||
m.BookVersion(semver="1.0.0", book_id=book.id).save()
|
||||
|
||||
flash("Book added!", "success")
|
||||
return redirect(url_for("book.get_all"))
|
||||
else:
|
||||
log(log.ERROR, "Book create errors: [%s]", form.errors)
|
||||
|
@ -58,3 +58,25 @@ def test_create_book(client: FlaskClient):
|
||||
book = m.Book.query.filter_by(label=BOOK_NAME).first()
|
||||
|
||||
assert book
|
||||
assert book.versions
|
||||
assert len(book.versions) == 1
|
||||
|
||||
|
||||
# def test_add_c(client: FlaskClient):
|
||||
# login(client)
|
||||
|
||||
|
||||
# response: Response = client.post(
|
||||
# "/book/create",
|
||||
# data=dict(
|
||||
# label=BOOK_NAME,
|
||||
# ),
|
||||
# follow_redirects=True,
|
||||
# )
|
||||
|
||||
# assert response.status_code == 200
|
||||
# assert b"Book added!" in response.data
|
||||
|
||||
# book = m.Book.query.filter_by(label=BOOK_NAME).first()
|
||||
|
||||
# assert book
|
||||
|
Loading…
x
Reference in New Issue
Block a user