fix tests

This commit is contained in:
SvyatoslavArtymovych 2023-05-12 11:59:00 +03:00
parent 827223d2b9
commit e48bd83c9e
3 changed files with 7 additions and 10 deletions

View File

@ -1,16 +1,14 @@
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, BooleanField from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, Length from wtforms.validators import DataRequired, Length
class BaseCommentForm(FlaskForm): class BaseCommentForm(FlaskForm):
text = StringField("Text", [DataRequired(), Length(3, 256)]) text = StringField("Text", [DataRequired(), Length(3, 256)])
marked = BooleanField("Marked")
included_with_interpretation = BooleanField("Included")
parent_id = StringField("Text")
class CreateCommentForm(BaseCommentForm): class CreateCommentForm(BaseCommentForm):
parent_id = StringField("Text")
submit = SubmitField("Create") submit = SubmitField("Create")
@ -19,7 +17,6 @@ class DeleteCommentForm(FlaskForm):
submit = SubmitField("Delete") submit = SubmitField("Delete")
class EditCommentForm(FlaskForm): class EditCommentForm(BaseCommentForm):
comment_id = StringField("Text") comment_id = StringField("Text")
text = StringField("Text", [DataRequired(), Length(3, 256)])
submit = SubmitField("Edit") submit = SubmitField("Edit")

View File

@ -150,7 +150,7 @@ def create_dummy_data():
# - comment 2 # - comment 2
# - comment 3 # - comment 3
# - comment 3.1 (marked) # - comment 3.1 (marked)
# - comment 3.2 (included_with_interpretation) # - comment 3.2 (approved)
# - comment 3.3 # - comment 3.3
comment_1 = m.Comment( comment_1 = m.Comment(
@ -197,7 +197,7 @@ def create_dummy_data():
comment_3_2 = m.Comment( comment_3_2 = m.Comment(
text="Dummy Comment 3.2 Text", text="Dummy Comment 3.2 Text",
user_id=user.id, user_id=user.id,
included_with_interpretation=True, approved=True,
parent_id=comment_3.id, parent_id=comment_3.id,
interpretation_id=interpretation_2.id, interpretation_id=interpretation_2.id,
).save() ).save()

View File

@ -190,7 +190,7 @@ def test_dummy_data(runner: FlaskCliRunner):
# - comment 2 # - comment 2
# - comment 3 # - comment 3
# - comment 3.1 (marked) # - comment 3.1 (marked)
# - comment 3.2 (included_with_interpretation) # - comment 3.2 (approved)
# - comment 3.3 # - comment 3.3
comment_1: m.Comment = m.Comment.query.filter_by( comment_1: m.Comment = m.Comment.query.filter_by(
@ -243,7 +243,7 @@ def test_dummy_data(runner: FlaskCliRunner):
assert comment_3_2 in comment_3.children assert comment_3_2 in comment_3.children
assert comment_3_3 in comment_3.children assert comment_3_3 in comment_3.children
assert comment_3_1.marked assert comment_3_1.marked
assert comment_3_2.included_with_interpretation assert comment_3_2.approved
assert comment_1 in interpretation_2.comments assert comment_1 in interpretation_2.comments
assert comment_2 in interpretation_2.comments assert comment_2 in interpretation_2.comments