diff options
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..a0733b5 --- /dev/null +++ b/tests/conftest.py | |||
@@ -0,0 +1,32 @@ | |||
1 | import pytest | ||
2 | |||
3 | @pytest.fixture | ||
4 | def api(): | ||
5 | import mastodon | ||
6 | return mastodon.Mastodon( | ||
7 | api_base_url='http://localhost:3000', | ||
8 | client_id='__MASTODON_PY_TEST_ID', | ||
9 | client_secret='__MASTODON_PY_TEST_SECRET', | ||
10 | access_token='__MASTODON_PY_TEST_TOKEN') | ||
11 | |||
12 | @pytest.fixture | ||
13 | def api_anonymous(): | ||
14 | import mastodon | ||
15 | return mastodon.Mastodon( | ||
16 | api_base_url='http://localhost:3000', | ||
17 | client_id='__MASTODON_PY_TEST_ID', | ||
18 | client_secret='__MASTODON_PY_TEST_SECRET') | ||
19 | |||
20 | @pytest.fixture() | ||
21 | def status(api): | ||
22 | _status = api.status_post('Toot!') | ||
23 | yield _status | ||
24 | api.status_delete(_status['id']) | ||
25 | |||
26 | |||
27 | @pytest.fixture() | ||
28 | def vcr_config(): | ||
29 | return dict( | ||
30 | match_on = ['method', 'path', 'query', 'body'], | ||
31 | decode_compressed_response = True | ||
32 | ) | ||