PackageComment: default RenderedComment to str()

With this, `bool(PackageComment.RenderedComment) == False`

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-07-19 19:42:41 -07:00
parent 13b4dbf541
commit c05fafea0e
2 changed files with 7 additions and 9 deletions

View file

@ -66,7 +66,4 @@ class PackageComment(Base):
params=("NULL"))
if self.RenderedComment is None:
raise IntegrityError(
statement="Column RenderedComment cannot be null.",
orig="PackageComments.RenderedComment",
params=("NULL"))
self.RenderedComment = str()

View file

@ -56,8 +56,9 @@ def test_package_comment_null_comments_raises_exception():
rollback()
def test_package_comment_null_renderedcomment_raises_exception():
with pytest.raises(IntegrityError):
create(PackageComment, PackageBase=pkgbase, User=user,
Comments="Test comment.")
rollback()
def test_package_comment_null_renderedcomment_defaults():
record = create(PackageComment,
PackageBase=pkgbase,
User=user,
Comments="Test comment.")
assert record.RenderedComment == str()