2017-11-30 02:13:44 +01:00
|
|
|
import pytest
|
2019-10-11 23:59:24 +02:00
|
|
|
import vcr
|
2017-11-30 02:13:44 +01:00
|
|
|
|
|
|
|
@pytest.mark.vcr()
|
2019-10-11 23:59:24 +02:00
|
|
|
def test_search(api):
|
2019-04-28 21:15:47 +02:00
|
|
|
results = api.search_v2('mastodonpy_test')
|
|
|
|
assert isinstance(results, dict)
|
|
|
|
|
2017-11-30 02:13:44 +01:00
|
|
|
results = api.search('mastodonpy_test')
|
|
|
|
assert isinstance(results, dict)
|
2019-04-28 21:15:47 +02:00
|
|
|
|
|
|
|
results = api.search('mastodonpy_test', result_type="statuses")
|
|
|
|
assert isinstance(results, dict)
|
|
|
|
assert len(results["hashtags"]) == 0
|
|
|
|
assert len(results["accounts"]) == 0
|
2019-10-11 23:59:24 +02:00
|
|
|
|
|
|
|
def test_search_pre_2_9_2(api):
|
2019-10-12 20:13:38 +02:00
|
|
|
api.mastodon_major = 2
|
|
|
|
api.mastodon_minor = 9
|
|
|
|
api.mastodon_patch = 1
|
2019-10-11 23:59:24 +02:00
|
|
|
with vcr.use_cassette('test_search.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'):
|
|
|
|
results = api.search_v1('mastodonpy_test')
|
|
|
|
assert isinstance(results, dict)
|
|
|
|
|
|
|
|
results = api.search_v2('mastodonpy_test')
|
|
|
|
assert isinstance(results, dict)
|
|
|
|
|
|
|
|
results = api.search('mastodonpy_test')
|
|
|
|
assert isinstance(results, dict)
|
|
|
|
|
|
|
|
results = api.search('mastodonpy_test', result_type="statuses")
|
|
|
|
assert isinstance(results, dict)
|
|
|
|
assert len(results["hashtags"]) == 0
|
|
|
|
assert len(results["accounts"]) == 0
|