def test_create_post_should_be_successful(with_factories: None, pg_session: Session) -> None: PostFactory.create_batch(5) query = get_create_mutation("title", "content") context = {"session": pg_session} result = schema.execute(query, context=context) assert not result.errors assert result.data assert result.data["createPost"]["post"]
def test_list_posts_should_be_successful( with_factories: None, pg_session: Session ) -> None: PostFactory.create_batch(5) query = "{posts {id title}}" context = {"session": pg_session} result = schema.execute(query, context=context) assert not result.errors assert len(result.data["posts"]) == 5
def test_get_post_list(pg_session: Session, with_factories: None) -> None: PostFactory.create_batch(BATCH_CREATE) posts = PostService(pg_session).get_list() assert len(posts) == BATCH_CREATE