Mastodonplus.py/tests/test_instance.py

34 líneas
903 B
Python
Original Vista normal Històric

2017-11-27 02:37:02 +01:00
import pytest
2018-05-06 02:26:19 +02:00
from mastodon.Mastodon import MastodonVersionError
2017-11-27 02:37:02 +01:00
@pytest.mark.vcr()
def test_instance(api):
instance = api.instance()
2017-11-27 02:37:02 +01:00
assert isinstance(instance, dict) # hehe, instance is instance
expected_keys = set(('description', 'email', 'title', 'uri', 'version', 'urls'))
assert set(instance.keys()) >= expected_keys
2018-05-06 02:26:19 +02:00
@pytest.mark.vcr()
def test_instance_activity(api):
activity = api.instance_activity()
assert len(activity) > 0
assert "statuses" in activity[0]
assert "logins" in activity[0]
assert "week" in activity[0]
@pytest.mark.vcr()
def test_instance_peers(api):
assert len(api.instance_peers()) == 0
@pytest.mark.vcr()
def test_low_version(api_low_version):
with pytest.raises(MastodonVersionError):
instance = api_low_version.instance()
2018-05-06 15:52:55 +02:00
@pytest.mark.vcr()
def test_emoji(api):
assert len(api.custom_emojis()) == 0