Skip to content

Commit

Permalink
test: add test for update
Browse files Browse the repository at this point in the history
  • Loading branch information
fbraem committed Sep 20, 2023
1 parent 0514bf3 commit ca75bf7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/src/tests/modules/page/pages/test_page_db_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest

from kwai.core.db.database import Database
from kwai.core.domain.entity import Entity
from kwai.core.domain.value_objects.owner import Owner
from kwai.core.domain.value_objects.text import DocumentFormat, Locale, LocaleText
from kwai.modules.page.pages.page import Application, PageEntity
Expand Down Expand Up @@ -59,4 +60,11 @@ async def test_get_by_id(repo: PageRepository, saved_page: PageEntity):
"""Test get by id."""
page = await repo.get_by_id(saved_page.id)
assert page is not None, "There should be a page."
print(page.content[0].title)


async def test_update(repo: PageRepository, saved_page: PageEntity):
"""Test update page."""
changed_page = Entity.replace(saved_page, remark="This is an update.")
await repo.update(changed_page)
page = await repo.get_by_id(changed_page.id)
assert page.remark == "This is an update.", "The page should be updated."

0 comments on commit ca75bf7

Please sign in to comment.