nice up some things, fix tests (maybe)

pull/397/head
halcy 2025-02-14 01:34:02 +02:00
rodzic 7f5169cef8
commit a7a2c11326
5 zmienionych plików z 22 dodań i 7 usunięć

Wyświetl plik

@ -113,3 +113,18 @@ Writing
.. automethod:: Mastodon.list_delete
.. automethod:: Mastodon.list_accounts_add
.. automethod:: Mastodon.list_accounts_delete
Following tags
--------------
These functions allow you to get information about tags that the logged in user is following and to follow
and unfollow tags.
Reading
~~~~~~~
.. automethod:: Mastodon.followed_tags
Writing
~~~~~~~
.. automethod:: Mastodon.tag_follow
.. automethod:: Mastodon.tag_unfollow

Wyświetl plik

@ -78,7 +78,7 @@ class Mastodon(Internals):
# Writing data: Followed tags
###
@api_version("4.0.0", "4.0.0", _DICT_VERSION_HASHTAG)
def follow_tag(self, hashtag: Union[Tag, str]) -> Tag:
def tag_follow(self, hashtag: Union[Tag, str]) -> Tag:
"""
Follow a tag.
@ -90,7 +90,7 @@ class Mastodon(Internals):
return self.__api_request('POST', f'/api/v1/tags/{hashtag}/follow')
@api_version("4.0.0", "4.0.0", _DICT_VERSION_HASHTAG)
def unfollow_tag(self, hashtag: Union[Tag, str]) -> Tag:
def tag_unfollow(self, hashtag: Union[Tag, str]) -> Tag:
"""
Unfollow a tag.

Wyświetl plik

@ -301,14 +301,14 @@ def test_featured_tags(api):
@pytest.mark.vcr()
def test_followed_hashtags(api):
api.unfollow_tag("heeho")
api.tag_unfollow("heeho")
followed_1 = api.followed_tags()
tag_1 = api.follow_tag("heeho")
tag_1 = api.tag_follow("heeho")
assert tag_1.name == "heeho"
assert tag_1.following == True
followed_2 = api.followed_tags()
assert len(followed_1) < len(followed_2)
tag_2 = api.unfollow_tag(tag_1)
tag_2 = api.tag_unfollow(tag_1)
assert tag_2.following == False
tag_3 = api.tag("heeho")
assert tag_3.following == False

Wyświetl plik

@ -2,7 +2,7 @@ import pytest
import vcr
from mastodon.Mastodon import MastodonAPIError
import json
from mastodon.types import Status, try_cast_recurse
from mastodon.return_types import Status, try_cast_recurse
try:
from mock import MagicMock
except ImportError:

Wyświetl plik

@ -1,6 +1,6 @@
import pytest
from datetime import datetime
from mastodon.types import IdType
from mastodon.return_types import IdType
import typing
import copy