aboutsummaryrefslogtreecommitdiff
blob: a1dc16168c1605e32f20157d212c0e6e93f3ee5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pytest

def _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN', version="2.3.0", version_check_mode="created"):
    import mastodon
    return mastodon.Mastodon(
            api_base_url='http://localhost:3000',
            client_id='__MASTODON_PY_TEST_CLIENT_ID',
            client_secret='__MASTODON_PY_TEST_CLIENT_SECRET',
            access_token=access_token,
            mastodon_version=version,
            version_check_mode=version_check_mode)


@pytest.fixture
def api():
    return _api()

@pytest.fixture
def api_low_version():
    return _api(version="1.2.0", version_check_mode="changed")

@pytest.fixture
def api2():
    return _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN_2')


@pytest.fixture
def api_anonymous():
    return _api(access_token=None)

@pytest.fixture()
def status(api):
    _status = api.status_post('Toot!')
    yield _status
    api.status_delete(_status['id'])


@pytest.fixture()
def vcr_config():
    return dict(
            match_on = ['method', 'path', 'query', 'body'],
            decode_compressed_response = True
            )
Powered by cgit v1.2.3 (git 2.41.0)