Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Teqed committed Sep 16, 2023
1 parent b6a317a commit 5bb9f21
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions fedifetcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)
from .api.firefish import api_firefish, api_firefish_types
from .api.lemmy import api_lemmy
from .api.mastodon import api_mastodon, api_mastodon_types
from .api.mastodon import api_mastodon
from .get import post_context
from .helpers import cache_manager, helpers, ordered_set
from .main import main
Expand All @@ -29,7 +29,6 @@
"api_firefish_types",
"api_lemmy",
"api_mastodon",
"api_mastodon_types",
"cache_manager",
"token_posts",
"find_trending_posts",
Expand Down
3 changes: 1 addition & 2 deletions fedifetcher/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .client import HttpMethod
from .firefish import api_firefish, api_firefish_types
from .lemmy import api_lemmy
from .mastodon import api_mastodon, api_mastodon_types
from .mastodon import api_mastodon
from .postgresql import postgresql

__all__ = [
Expand All @@ -15,6 +15,5 @@
"api_firefish_types",
"api_lemmy",
"api_mastodon",
"api_mastodon_types",
"postgresql",
]
3 changes: 1 addition & 2 deletions fedifetcher/api/mastodon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
structures
"""

from . import api_mastodon_types
from .api_mastodon import Mastodon

__all__ = ["Mastodon", "api_mastodon_types"]
__all__ = ["Mastodon"]
7 changes: 5 additions & 2 deletions tests/api/mastodon/test_api_mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest.mock import AsyncMock, MagicMock

import pytest
from fedifetcher.api.api import ApiError

from fedifetcher.api.mastodon.api_mastodon import Mastodon, filter_language

Expand Down Expand Up @@ -127,8 +128,10 @@ async def test_get(self) -> None:
async def test_get_failed(self) -> None:
"""Test the get method."""
self.mastodon.client.get = AsyncMock(return_value=False)
result = await self.mastodon.get("url")
assert result is False
with pytest.raises(ApiError) as exception:
await self.mastodon.get("url")
exceptions_raised = exception.value
assert isinstance(exceptions_raised, ApiError)

async def test_get_home_status_id_from_url_list(self) -> None:
"""Test the get_home_status_id_from_url_list method."""
Expand Down

0 comments on commit 5bb9f21

Please sign in to comment.