From f42032dafcefd422d3819ace721accf75f2d0c91 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Fri, 11 Oct 2019 22:07:51 +0200 Subject: Add new card behaviour, freeze old test --- tests/test_status.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/test_status.py') 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 from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError import datetime import pytz +import vcr @pytest.mark.vcr() def test_status(status, api): @@ -28,6 +29,8 @@ def test_status_missing(api): api.status(0) # Messy and will only work if there is an internet connection that is decent, obviously. +# Also, deprecated, but still a good test (Mastodon.py tries to fake the old behaviour +# internally) @pytest.mark.vcr() def test_status_card(api): import time @@ -39,6 +42,19 @@ def test_status_card(api): finally: api.status_delete(status['id']) +# Old-version card api +def test_status_card_pre_2_9_2(api): + with vcr.use_cassette('test_status_card.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): + import time + status = api.status_post("http://example.org/") + time.sleep(5) # Card generation may take time + card = api.status_card(status['id']) + try: + assert card + finally: + api.status_delete(status['id']) + + @pytest.mark.vcr() def test_status_context(status, api): context = api.status_context(status['id']) -- cgit v1.2.3