diff options
Diffstat (limited to 'tests/test_status.py')
-rw-r--r-- | tests/test_status.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_status.py b/tests/test_status.py index ef27f9c..32f57a4 100644 --- a/tests/test_status.py +++ b/tests/test_status.py | |||
@@ -2,6 +2,7 @@ import pytest | |||
2 | from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError | 2 | from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError |
3 | import datetime | 3 | import datetime |
4 | import pytz | 4 | import pytz |
5 | import vcr | ||
5 | 6 | ||
6 | @pytest.mark.vcr() | 7 | @pytest.mark.vcr() |
7 | def test_status(status, api): | 8 | def test_status(status, api): |
@@ -28,6 +29,8 @@ def test_status_missing(api): | |||
28 | api.status(0) | 29 | api.status(0) |
29 | 30 | ||
30 | # Messy and will only work if there is an internet connection that is decent, obviously. | 31 | # Messy and will only work if there is an internet connection that is decent, obviously. |
32 | # Also, deprecated, but still a good test (Mastodon.py tries to fake the old behaviour | ||
33 | # internally) | ||
31 | @pytest.mark.vcr() | 34 | @pytest.mark.vcr() |
32 | def test_status_card(api): | 35 | def test_status_card(api): |
33 | import time | 36 | import time |
@@ -39,6 +42,19 @@ def test_status_card(api): | |||
39 | finally: | 42 | finally: |
40 | api.status_delete(status['id']) | 43 | api.status_delete(status['id']) |
41 | 44 | ||
45 | # Old-version card api | ||
46 | def test_status_card_pre_2_9_2(api): | ||
47 | with vcr.use_cassette('test_status_card.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): | ||
48 | import time | ||
49 | status = api.status_post("http://example.org/") | ||
50 | time.sleep(5) # Card generation may take time | ||
51 | card = api.status_card(status['id']) | ||
52 | try: | ||
53 | assert card | ||
54 | finally: | ||
55 | api.status_delete(status['id']) | ||
56 | |||
57 | |||
42 | @pytest.mark.vcr() | 58 | @pytest.mark.vcr() |
43 | def test_status_context(status, api): | 59 | def test_status_context(status, api): |
44 | context = api.status_context(status['id']) | 60 | context = api.status_context(status['id']) |