diff --git a/fedifetcher/__init__.py b/fedifetcher/__init__.py index 0181b4c4..ba98b88b 100644 --- a/fedifetcher/__init__.py +++ b/fedifetcher/__init__.py @@ -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 @@ -29,7 +29,6 @@ "api_firefish_types", "api_lemmy", "api_mastodon", - "api_mastodon_types", "cache_manager", "token_posts", "find_trending_posts", diff --git a/fedifetcher/api/__init__.py b/fedifetcher/api/__init__.py index cab70f1e..47cb2a26 100644 --- a/fedifetcher/api/__init__.py +++ b/fedifetcher/api/__init__.py @@ -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__ = [ @@ -15,6 +15,5 @@ "api_firefish_types", "api_lemmy", "api_mastodon", - "api_mastodon_types", "postgresql", ] diff --git a/fedifetcher/api/mastodon/__init__.py b/fedifetcher/api/mastodon/__init__.py index 9dceee53..4346d127 100644 --- a/fedifetcher/api/mastodon/__init__.py +++ b/fedifetcher/api/mastodon/__init__.py @@ -7,7 +7,6 @@ structures """ -from . import api_mastodon_types from .api_mastodon import Mastodon -__all__ = ["Mastodon", "api_mastodon_types"] +__all__ = ["Mastodon"] diff --git a/tests/api/mastodon/test_api_mastodon.py b/tests/api/mastodon/test_api_mastodon.py index 3904476f..1e53ec23 100644 --- a/tests/api/mastodon/test_api_mastodon.py +++ b/tests/api/mastodon/test_api_mastodon.py @@ -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 @@ -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."""