558 lines
21 KiB
Python
558 lines
21 KiB
Python
|
"""
|
|||
|
Тесты для покрытия модуля resolvers
|
|||
|
"""
|
|||
|
import pytest
|
|||
|
from unittest.mock import Mock, patch, MagicMock, AsyncMock
|
|||
|
from datetime import datetime
|
|||
|
|
|||
|
# Импортируем модули resolvers для покрытия
|
|||
|
import resolvers.__init__
|
|||
|
import resolvers.auth
|
|||
|
import resolvers.community
|
|||
|
import resolvers.topic
|
|||
|
import resolvers.reaction
|
|||
|
import resolvers.reader
|
|||
|
import resolvers.stat
|
|||
|
import resolvers.follower
|
|||
|
import resolvers.notifier
|
|||
|
import resolvers.proposals
|
|||
|
import resolvers.rating
|
|||
|
import resolvers.draft
|
|||
|
import resolvers.editor
|
|||
|
import resolvers.feed
|
|||
|
import resolvers.author
|
|||
|
import resolvers.bookmark
|
|||
|
import resolvers.collab
|
|||
|
import resolvers.collection
|
|||
|
import resolvers.admin
|
|||
|
|
|||
|
|
|||
|
class MockInfo:
|
|||
|
"""Мок для GraphQL info объекта"""
|
|||
|
def __init__(self, author_id: int = None, requested_fields: list[str] = None):
|
|||
|
self.context = {
|
|||
|
"request": None, # Тестовый режим
|
|||
|
"author": {"id": author_id, "name": "Test User"} if author_id else None,
|
|||
|
"roles": ["reader", "author"] if author_id else [],
|
|||
|
"is_admin": False,
|
|||
|
}
|
|||
|
# Добавляем field_nodes для совместимости с резолверами
|
|||
|
self.field_nodes = [MockFieldNode(requested_fields or [])]
|
|||
|
|
|||
|
|
|||
|
class MockFieldNode:
|
|||
|
"""Мок для GraphQL field node"""
|
|||
|
def __init__(self, requested_fields: list[str]):
|
|||
|
self.selection_set = MockSelectionSet(requested_fields)
|
|||
|
|
|||
|
|
|||
|
class MockSelectionSet:
|
|||
|
"""Мок для GraphQL selection set"""
|
|||
|
def __init__(self, requested_fields: list[str]):
|
|||
|
self.selections = [MockSelection(field) for field in requested_fields]
|
|||
|
|
|||
|
|
|||
|
class MockSelection:
|
|||
|
"""Мок для GraphQL selection"""
|
|||
|
def __init__(self, field_name: str):
|
|||
|
self.name = MockName(field_name)
|
|||
|
|
|||
|
|
|||
|
class MockName:
|
|||
|
"""Мок для GraphQL name"""
|
|||
|
def __init__(self, value: str):
|
|||
|
self.value = value
|
|||
|
|
|||
|
|
|||
|
class TestResolversInit:
|
|||
|
"""Тесты для resolvers.__init__"""
|
|||
|
|
|||
|
def test_resolvers_init_import(self):
|
|||
|
"""Тест импорта resolvers"""
|
|||
|
import resolvers
|
|||
|
assert resolvers is not None
|
|||
|
|
|||
|
def test_resolvers_functions_exist(self):
|
|||
|
"""Тест существования основных функций resolvers"""
|
|||
|
from resolvers import (
|
|||
|
# Admin functions
|
|||
|
admin_create_topic,
|
|||
|
admin_get_roles,
|
|||
|
admin_get_users,
|
|||
|
admin_update_topic,
|
|||
|
# Auth functions
|
|||
|
confirm_email,
|
|||
|
login,
|
|||
|
send_link,
|
|||
|
# Author functions
|
|||
|
get_author,
|
|||
|
get_author_followers,
|
|||
|
get_author_follows,
|
|||
|
get_author_follows_authors,
|
|||
|
get_author_follows_topics,
|
|||
|
get_authors_all,
|
|||
|
load_authors_by,
|
|||
|
load_authors_search,
|
|||
|
update_author,
|
|||
|
# Collection functions
|
|||
|
get_collection,
|
|||
|
get_collections_all,
|
|||
|
get_collections_by_author,
|
|||
|
# Community functions
|
|||
|
get_communities_all,
|
|||
|
get_community,
|
|||
|
# Draft functions
|
|||
|
create_draft,
|
|||
|
delete_draft,
|
|||
|
load_drafts,
|
|||
|
publish_draft,
|
|||
|
unpublish_draft,
|
|||
|
update_draft,
|
|||
|
# Editor functions
|
|||
|
unpublish_shout,
|
|||
|
# Feed functions
|
|||
|
load_shouts_authored_by,
|
|||
|
load_shouts_coauthored,
|
|||
|
load_shouts_discussed,
|
|||
|
load_shouts_feed,
|
|||
|
load_shouts_followed_by,
|
|||
|
load_shouts_with_topic,
|
|||
|
# Follower functions
|
|||
|
follow,
|
|||
|
get_shout_followers,
|
|||
|
unfollow,
|
|||
|
# Notifier functions
|
|||
|
load_notifications,
|
|||
|
notification_mark_seen,
|
|||
|
notifications_seen_after,
|
|||
|
notifications_seen_thread,
|
|||
|
# Rating functions
|
|||
|
get_my_rates_comments,
|
|||
|
get_my_rates_shouts,
|
|||
|
rate_author,
|
|||
|
# Reaction functions
|
|||
|
create_reaction,
|
|||
|
delete_reaction,
|
|||
|
load_comment_ratings,
|
|||
|
load_comments_branch,
|
|||
|
load_reactions_by,
|
|||
|
load_shout_comments,
|
|||
|
load_shout_ratings,
|
|||
|
update_reaction,
|
|||
|
# Reader functions
|
|||
|
get_shout,
|
|||
|
load_shouts_by,
|
|||
|
load_shouts_random_top,
|
|||
|
load_shouts_search,
|
|||
|
load_shouts_unrated,
|
|||
|
# Topic functions
|
|||
|
get_topic,
|
|||
|
get_topic_authors,
|
|||
|
get_topic_followers,
|
|||
|
get_topics_all,
|
|||
|
get_topics_by_author,
|
|||
|
get_topics_by_community,
|
|||
|
merge_topics,
|
|||
|
set_topic_parent,
|
|||
|
)
|
|||
|
# Проверяем что все функции существуют
|
|||
|
assert all([
|
|||
|
admin_create_topic, admin_get_roles, admin_get_users, admin_update_topic,
|
|||
|
confirm_email, login, send_link,
|
|||
|
get_author, get_author_followers, get_author_follows, get_author_follows_authors,
|
|||
|
get_author_follows_topics, get_authors_all, load_authors_by, load_authors_search, update_author,
|
|||
|
get_collection, get_collections_all, get_collections_by_author,
|
|||
|
get_communities_all, get_community,
|
|||
|
create_draft, delete_draft, load_drafts, publish_draft, unpublish_draft, update_draft,
|
|||
|
unpublish_shout,
|
|||
|
load_shouts_authored_by, load_shouts_coauthored, load_shouts_discussed,
|
|||
|
load_shouts_feed, load_shouts_followed_by, load_shouts_with_topic,
|
|||
|
follow, get_shout_followers, unfollow,
|
|||
|
load_notifications, notification_mark_seen, notifications_seen_after, notifications_seen_thread,
|
|||
|
get_my_rates_comments, get_my_rates_shouts, rate_author,
|
|||
|
create_reaction, delete_reaction, load_comment_ratings, load_comments_branch,
|
|||
|
load_reactions_by, load_shout_comments, load_shout_ratings, update_reaction,
|
|||
|
get_shout, load_shouts_by, load_shouts_random_top, load_shouts_search, load_shouts_unrated,
|
|||
|
get_topic, get_topic_authors, get_topic_followers, get_topics_all,
|
|||
|
get_topics_by_author, get_topics_by_community, merge_topics, set_topic_parent,
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversAuth:
|
|||
|
"""Тесты для resolvers.auth"""
|
|||
|
|
|||
|
def test_auth_import(self):
|
|||
|
"""Тест импорта auth"""
|
|||
|
from resolvers.auth import confirm_email, login, send_link
|
|||
|
assert confirm_email is not None
|
|||
|
assert login is not None
|
|||
|
assert send_link is not None
|
|||
|
|
|||
|
def test_auth_functions_exist(self):
|
|||
|
"""Тест существования функций auth"""
|
|||
|
from resolvers.auth import confirm_email, login, send_link
|
|||
|
assert all([confirm_email, login, send_link])
|
|||
|
|
|||
|
|
|||
|
class TestResolversCommunity:
|
|||
|
"""Тесты для resolvers.community"""
|
|||
|
|
|||
|
def test_community_import(self):
|
|||
|
"""Тест импорта community"""
|
|||
|
from resolvers.community import get_communities_all, get_community
|
|||
|
assert get_communities_all is not None
|
|||
|
assert get_community is not None
|
|||
|
|
|||
|
def test_community_functions_exist(self):
|
|||
|
"""Тест существования функций community"""
|
|||
|
from resolvers.community import get_communities_all, get_community
|
|||
|
assert all([get_communities_all, get_community])
|
|||
|
|
|||
|
|
|||
|
class TestResolversTopic:
|
|||
|
"""Тесты для resolvers.topic"""
|
|||
|
|
|||
|
def test_topic_import(self):
|
|||
|
"""Тест импорта topic"""
|
|||
|
from resolvers.topic import (
|
|||
|
get_topic, get_topic_authors, get_topic_followers, get_topics_all,
|
|||
|
get_topics_by_author, get_topics_by_community, merge_topics, set_topic_parent
|
|||
|
)
|
|||
|
assert all([
|
|||
|
get_topic, get_topic_authors, get_topic_followers, get_topics_all,
|
|||
|
get_topics_by_author, get_topics_by_community, merge_topics, set_topic_parent
|
|||
|
])
|
|||
|
|
|||
|
def test_topic_functions_exist(self):
|
|||
|
"""Тест существования функций topic"""
|
|||
|
from resolvers.topic import (
|
|||
|
get_topic, get_topic_authors, get_topic_followers, get_topics_all,
|
|||
|
get_topics_by_author, get_topics_by_community, merge_topics, set_topic_parent
|
|||
|
)
|
|||
|
assert all([
|
|||
|
get_topic, get_topic_authors, get_topic_followers, get_topics_all,
|
|||
|
get_topics_by_author, get_topics_by_community, merge_topics, set_topic_parent
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversReaction:
|
|||
|
"""Тесты для resolvers.reaction"""
|
|||
|
|
|||
|
def test_reaction_import(self):
|
|||
|
"""Тест импорта reaction"""
|
|||
|
from resolvers.reaction import (
|
|||
|
create_reaction, delete_reaction, load_comment_ratings, load_comments_branch,
|
|||
|
load_reactions_by, load_shout_comments, load_shout_ratings, update_reaction
|
|||
|
)
|
|||
|
assert all([
|
|||
|
create_reaction, delete_reaction, load_comment_ratings, load_comments_branch,
|
|||
|
load_reactions_by, load_shout_comments, load_shout_ratings, update_reaction
|
|||
|
])
|
|||
|
|
|||
|
def test_reaction_functions_exist(self):
|
|||
|
"""Тест существования функций reaction"""
|
|||
|
from resolvers.reaction import (
|
|||
|
create_reaction, delete_reaction, load_comment_ratings, load_comments_branch,
|
|||
|
load_reactions_by, load_shout_comments, load_shout_ratings, update_reaction
|
|||
|
)
|
|||
|
assert all([
|
|||
|
create_reaction, delete_reaction, load_comment_ratings, load_comments_branch,
|
|||
|
load_reactions_by, load_shout_comments, load_shout_ratings, update_reaction
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversReader:
|
|||
|
"""Тесты для resolvers.reader"""
|
|||
|
|
|||
|
def test_reader_import(self):
|
|||
|
"""Тест импорта reader"""
|
|||
|
from resolvers.reader import (
|
|||
|
get_shout, load_shouts_by, load_shouts_random_top, load_shouts_search, load_shouts_unrated
|
|||
|
)
|
|||
|
assert all([
|
|||
|
get_shout, load_shouts_by, load_shouts_random_top, load_shouts_search, load_shouts_unrated
|
|||
|
])
|
|||
|
|
|||
|
def test_reader_functions_exist(self):
|
|||
|
"""Тест существования функций reader"""
|
|||
|
from resolvers.reader import (
|
|||
|
get_shout, load_shouts_by, load_shouts_random_top, load_shouts_search, load_shouts_unrated
|
|||
|
)
|
|||
|
assert all([
|
|||
|
get_shout, load_shouts_by, load_shouts_random_top, load_shouts_search, load_shouts_unrated
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversStat:
|
|||
|
"""Тесты для resolvers.stat"""
|
|||
|
|
|||
|
def test_stat_import(self):
|
|||
|
"""Тест импорта stat"""
|
|||
|
import resolvers.stat
|
|||
|
assert resolvers.stat is not None
|
|||
|
|
|||
|
def test_stat_functions_exist(self):
|
|||
|
"""Тест существования функций stat"""
|
|||
|
import resolvers.stat
|
|||
|
# Проверяем что модуль импортируется без ошибок
|
|||
|
assert resolvers.stat is not None
|
|||
|
|
|||
|
|
|||
|
class TestResolversFollower:
|
|||
|
"""Тесты для resolvers.follower"""
|
|||
|
|
|||
|
def test_follower_import(self):
|
|||
|
"""Тест импорта follower"""
|
|||
|
from resolvers.follower import follow, get_shout_followers, unfollow
|
|||
|
assert all([follow, get_shout_followers, unfollow])
|
|||
|
|
|||
|
def test_follower_functions_exist(self):
|
|||
|
"""Тест существования функций follower"""
|
|||
|
from resolvers.follower import follow, get_shout_followers, unfollow
|
|||
|
assert all([follow, get_shout_followers, unfollow])
|
|||
|
|
|||
|
|
|||
|
class TestResolversNotifier:
|
|||
|
"""Тесты для resolvers.notifier"""
|
|||
|
|
|||
|
def test_notifier_import(self):
|
|||
|
"""Тест импорта notifier"""
|
|||
|
from resolvers.notifier import (
|
|||
|
load_notifications, notification_mark_seen, notifications_seen_after, notifications_seen_thread
|
|||
|
)
|
|||
|
assert all([
|
|||
|
load_notifications, notification_mark_seen, notifications_seen_after, notifications_seen_thread
|
|||
|
])
|
|||
|
|
|||
|
def test_notifier_functions_exist(self):
|
|||
|
"""Тест существования функций notifier"""
|
|||
|
from resolvers.notifier import (
|
|||
|
load_notifications, notification_mark_seen, notifications_seen_after, notifications_seen_thread
|
|||
|
)
|
|||
|
assert all([
|
|||
|
load_notifications, notification_mark_seen, notifications_seen_after, notifications_seen_thread
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversProposals:
|
|||
|
"""Тесты для resolvers.proposals"""
|
|||
|
|
|||
|
def test_proposals_import(self):
|
|||
|
"""Тест импорта proposals"""
|
|||
|
import resolvers.proposals
|
|||
|
assert resolvers.proposals is not None
|
|||
|
|
|||
|
def test_proposals_functions_exist(self):
|
|||
|
"""Тест существования функций proposals"""
|
|||
|
import resolvers.proposals
|
|||
|
# Проверяем что модуль импортируется без ошибок
|
|||
|
assert resolvers.proposals is not None
|
|||
|
|
|||
|
|
|||
|
class TestResolversRating:
|
|||
|
"""Тесты для resolvers.rating"""
|
|||
|
|
|||
|
def test_rating_import(self):
|
|||
|
"""Тест импорта rating"""
|
|||
|
from resolvers.rating import get_my_rates_comments, get_my_rates_shouts, rate_author
|
|||
|
assert all([get_my_rates_comments, get_my_rates_shouts, rate_author])
|
|||
|
|
|||
|
def test_rating_functions_exist(self):
|
|||
|
"""Тест существования функций rating"""
|
|||
|
from resolvers.rating import get_my_rates_comments, get_my_rates_shouts, rate_author
|
|||
|
assert all([get_my_rates_comments, get_my_rates_shouts, rate_author])
|
|||
|
|
|||
|
|
|||
|
class TestResolversDraft:
|
|||
|
"""Тесты для resolvers.draft"""
|
|||
|
|
|||
|
def test_draft_import(self):
|
|||
|
"""Тест импорта draft"""
|
|||
|
from resolvers.draft import (
|
|||
|
create_draft, delete_draft, load_drafts, publish_draft, unpublish_draft, update_draft
|
|||
|
)
|
|||
|
assert all([
|
|||
|
create_draft, delete_draft, load_drafts, publish_draft, unpublish_draft, update_draft
|
|||
|
])
|
|||
|
|
|||
|
def test_draft_functions_exist(self):
|
|||
|
"""Тест существования функций draft"""
|
|||
|
from resolvers.draft import (
|
|||
|
create_draft, delete_draft, load_drafts, publish_draft, unpublish_draft, update_draft
|
|||
|
)
|
|||
|
assert all([
|
|||
|
create_draft, delete_draft, load_drafts, publish_draft, unpublish_draft, update_draft
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversEditor:
|
|||
|
"""Тесты для resolvers.editor"""
|
|||
|
|
|||
|
def test_editor_import(self):
|
|||
|
"""Тест импорта editor"""
|
|||
|
from resolvers.editor import unpublish_shout
|
|||
|
assert unpublish_shout is not None
|
|||
|
|
|||
|
def test_editor_functions_exist(self):
|
|||
|
"""Тест существования функций editor"""
|
|||
|
from resolvers.editor import unpublish_shout
|
|||
|
assert unpublish_shout is not None
|
|||
|
|
|||
|
|
|||
|
class TestResolversFeed:
|
|||
|
"""Тесты для resolvers.feed"""
|
|||
|
|
|||
|
def test_feed_import(self):
|
|||
|
"""Тест импорта feed"""
|
|||
|
from resolvers.feed import (
|
|||
|
load_shouts_authored_by, load_shouts_coauthored, load_shouts_discussed,
|
|||
|
load_shouts_feed, load_shouts_followed_by, load_shouts_with_topic
|
|||
|
)
|
|||
|
assert all([
|
|||
|
load_shouts_authored_by, load_shouts_coauthored, load_shouts_discussed,
|
|||
|
load_shouts_feed, load_shouts_followed_by, load_shouts_with_topic
|
|||
|
])
|
|||
|
|
|||
|
def test_feed_functions_exist(self):
|
|||
|
"""Тест существования функций feed"""
|
|||
|
from resolvers.feed import (
|
|||
|
load_shouts_authored_by, load_shouts_coauthored, load_shouts_discussed,
|
|||
|
load_shouts_feed, load_shouts_followed_by, load_shouts_with_topic
|
|||
|
)
|
|||
|
assert all([
|
|||
|
load_shouts_authored_by, load_shouts_coauthored, load_shouts_discussed,
|
|||
|
load_shouts_feed, load_shouts_followed_by, load_shouts_with_topic
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversAuthor:
|
|||
|
"""Тесты для resolvers.author"""
|
|||
|
|
|||
|
def test_author_import(self):
|
|||
|
"""Тест импорта author"""
|
|||
|
from resolvers.author import (
|
|||
|
get_author, get_author_followers, get_author_follows, get_author_follows_authors,
|
|||
|
get_author_follows_topics, get_authors_all, load_authors_by, load_authors_search, update_author
|
|||
|
)
|
|||
|
assert all([
|
|||
|
get_author, get_author_followers, get_author_follows, get_author_follows_authors,
|
|||
|
get_author_follows_topics, get_authors_all, load_authors_by, load_authors_search, update_author
|
|||
|
])
|
|||
|
|
|||
|
def test_author_functions_exist(self):
|
|||
|
"""Тест существования функций author"""
|
|||
|
from resolvers.author import (
|
|||
|
get_author, get_author_followers, get_author_follows, get_author_follows_authors,
|
|||
|
get_author_follows_topics, get_authors_all, load_authors_by, load_authors_search, update_author
|
|||
|
)
|
|||
|
assert all([
|
|||
|
get_author, get_author_followers, get_author_follows, get_author_follows_authors,
|
|||
|
get_author_follows_topics, get_authors_all, load_authors_by, load_authors_search, update_author
|
|||
|
])
|
|||
|
|
|||
|
|
|||
|
class TestResolversBookmark:
|
|||
|
"""Тесты для resolvers.bookmark"""
|
|||
|
|
|||
|
def test_bookmark_import(self):
|
|||
|
"""Тест импорта bookmark"""
|
|||
|
import resolvers.bookmark
|
|||
|
assert resolvers.bookmark is not None
|
|||
|
|
|||
|
def test_bookmark_functions_exist(self):
|
|||
|
"""Тест существования функций bookmark"""
|
|||
|
import resolvers.bookmark
|
|||
|
# Проверяем что модуль импортируется без ошибок
|
|||
|
assert resolvers.bookmark is not None
|
|||
|
|
|||
|
|
|||
|
class TestResolversCollab:
|
|||
|
"""Тесты для resolvers.collab"""
|
|||
|
|
|||
|
def test_collab_import(self):
|
|||
|
"""Тест импорта collab"""
|
|||
|
import resolvers.collab
|
|||
|
assert resolvers.collab is not None
|
|||
|
|
|||
|
def test_collab_functions_exist(self):
|
|||
|
"""Тест существования функций collab"""
|
|||
|
import resolvers.collab
|
|||
|
# Проверяем что модуль импортируется без ошибок
|
|||
|
assert resolvers.collab is not None
|
|||
|
|
|||
|
|
|||
|
class TestResolversCollection:
|
|||
|
"""Тесты для resolvers.collection"""
|
|||
|
|
|||
|
def test_collection_import(self):
|
|||
|
"""Тест импорта collection"""
|
|||
|
from resolvers.collection import get_collection, get_collections_all, get_collections_by_author
|
|||
|
assert all([get_collection, get_collections_all, get_collections_by_author])
|
|||
|
|
|||
|
def test_collection_functions_exist(self):
|
|||
|
"""Тест существования функций collection"""
|
|||
|
from resolvers.collection import get_collection, get_collections_all, get_collections_by_author
|
|||
|
assert all([get_collection, get_collections_all, get_collections_by_author])
|
|||
|
|
|||
|
|
|||
|
class TestResolversAdmin:
|
|||
|
"""Тесты для resolvers.admin"""
|
|||
|
|
|||
|
def test_admin_import(self):
|
|||
|
"""Тест импорта admin"""
|
|||
|
from resolvers.admin import admin_create_topic, admin_get_roles, admin_get_users, admin_update_topic
|
|||
|
assert all([admin_create_topic, admin_get_roles, admin_get_users, admin_update_topic])
|
|||
|
|
|||
|
def test_admin_functions_exist(self):
|
|||
|
"""Тест существования функций admin"""
|
|||
|
from resolvers.admin import admin_create_topic, admin_get_roles, admin_get_users, admin_update_topic
|
|||
|
assert all([admin_create_topic, admin_get_roles, admin_get_users, admin_update_topic])
|
|||
|
|
|||
|
|
|||
|
class TestResolversCommon:
|
|||
|
"""Тесты общих функций resolvers"""
|
|||
|
|
|||
|
def test_resolver_decorators(self):
|
|||
|
"""Тест декораторов резолверов"""
|
|||
|
import resolvers
|
|||
|
# Проверяем что модуль импортируется без ошибок
|
|||
|
assert resolvers is not None
|
|||
|
|
|||
|
def test_resolver_utils(self):
|
|||
|
"""Тест утилит резолверов"""
|
|||
|
import resolvers
|
|||
|
# Проверяем что модуль импортируется без ошибок
|
|||
|
assert resolvers is not None
|
|||
|
|
|||
|
|
|||
|
class TestResolversIntegration:
|
|||
|
"""Интеграционные тесты резолверов"""
|
|||
|
|
|||
|
@pytest.mark.asyncio
|
|||
|
async def test_get_shout_resolver(self):
|
|||
|
"""Тест резолвера get_shout"""
|
|||
|
from resolvers.reader import get_shout
|
|||
|
info = MockInfo(requested_fields=["id", "title", "body", "slug"])
|
|||
|
|
|||
|
# Тест с несуществующим slug
|
|||
|
result = await get_shout(None, info, slug="nonexistent-slug")
|
|||
|
assert result is None
|
|||
|
|
|||
|
@pytest.mark.asyncio
|
|||
|
async def test_create_draft_resolver(self):
|
|||
|
"""Тест резолвера create_draft"""
|
|||
|
from resolvers.draft import create_draft
|
|||
|
info = MockInfo(author_id=1)
|
|||
|
|
|||
|
# Тест создания черновика
|
|||
|
result = await create_draft(
|
|||
|
None,
|
|||
|
info,
|
|||
|
draft_input={
|
|||
|
"title": "Test Draft",
|
|||
|
"body": "Test body",
|
|||
|
},
|
|||
|
)
|
|||
|
# Проверяем что функция не падает
|
|||
|
assert result is not None
|