Mastodonplus.py/tests/conftest.py

40 líneas
851 B
Python
Original Vista normal Històric

import pytest
2017-11-29 21:42:20 +01:00
def _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN'):
import mastodon
return mastodon.Mastodon(
api_base_url='http://localhost:3000',
2017-11-29 21:42:20 +01:00
client_id='__MASTODON_PY_TEST_CLIENT_ID',
client_secret='__MASTODON_PY_TEST_CLIENT_SECRET',
access_token=access_token)
@pytest.fixture
def api():
return _api()
@pytest.fixture
def api2():
return _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN_2')
2017-11-27 14:19:21 +01:00
@pytest.fixture
def api_anonymous():
2017-11-29 21:42:20 +01:00
return _api(access_token=None)
2017-11-27 14:19:21 +01:00
@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
)