Coverage for src/tests/modules/portal/test_get_authors.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
1"""Module for testing the use case 'get authors'."""
3import pytest
5from kwai_bc_portal.domain.author import AuthorEntity
6from kwai_bc_portal.get_authors import GetAuthors, GetAuthorsCommand
7from kwai_bc_portal.repositories.author_db_repository import AuthorDbRepository
8from kwai_core.db.database import Database
9from kwai_core.domain.presenter import CountIterableAsyncPresenter
12pytestmark = [pytest.mark.db]
15async def test_get_authors(database: Database, make_author_in_db):
16 """Test the 'get authors' use case."""
17 await make_author_in_db()
18 command = GetAuthorsCommand()
19 presenter = CountIterableAsyncPresenter[AuthorEntity]()
20 await GetAuthors(AuthorDbRepository(database), presenter).execute(command)
21 assert presenter.count > 0, "There should be at least 1 author"