kopia lustrzana https://github.com/halcy/Mastodon.py
nice up some things, fix tests (maybe)
rodzic
7f5169cef8
commit
a7a2c11326
|
@ -113,3 +113,18 @@ Writing
|
||||||
.. automethod:: Mastodon.list_delete
|
.. automethod:: Mastodon.list_delete
|
||||||
.. automethod:: Mastodon.list_accounts_add
|
.. automethod:: Mastodon.list_accounts_add
|
||||||
.. automethod:: Mastodon.list_accounts_delete
|
.. 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
|
|
@ -78,7 +78,7 @@ class Mastodon(Internals):
|
||||||
# Writing data: Followed tags
|
# Writing data: Followed tags
|
||||||
###
|
###
|
||||||
@api_version("4.0.0", "4.0.0", _DICT_VERSION_HASHTAG)
|
@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.
|
Follow a tag.
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class Mastodon(Internals):
|
||||||
return self.__api_request('POST', f'/api/v1/tags/{hashtag}/follow')
|
return self.__api_request('POST', f'/api/v1/tags/{hashtag}/follow')
|
||||||
|
|
||||||
@api_version("4.0.0", "4.0.0", _DICT_VERSION_HASHTAG)
|
@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.
|
Unfollow a tag.
|
||||||
|
|
||||||
|
|
|
@ -301,14 +301,14 @@ def test_featured_tags(api):
|
||||||
|
|
||||||
@pytest.mark.vcr()
|
@pytest.mark.vcr()
|
||||||
def test_followed_hashtags(api):
|
def test_followed_hashtags(api):
|
||||||
api.unfollow_tag("heeho")
|
api.tag_unfollow("heeho")
|
||||||
followed_1 = api.followed_tags()
|
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.name == "heeho"
|
||||||
assert tag_1.following == True
|
assert tag_1.following == True
|
||||||
followed_2 = api.followed_tags()
|
followed_2 = api.followed_tags()
|
||||||
assert len(followed_1) < len(followed_2)
|
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
|
assert tag_2.following == False
|
||||||
tag_3 = api.tag("heeho")
|
tag_3 = api.tag("heeho")
|
||||||
assert tag_3.following == False
|
assert tag_3.following == False
|
||||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
||||||
import vcr
|
import vcr
|
||||||
from mastodon.Mastodon import MastodonAPIError
|
from mastodon.Mastodon import MastodonAPIError
|
||||||
import json
|
import json
|
||||||
from mastodon.types import Status, try_cast_recurse
|
from mastodon.return_types import Status, try_cast_recurse
|
||||||
try:
|
try:
|
||||||
from mock import MagicMock
|
from mock import MagicMock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from mastodon.types import IdType
|
from mastodon.return_types import IdType
|
||||||
import typing
|
import typing
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue