From 4b00c448f4a55859d5177c981a8fc4b388e8b5b3 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sun, 6 May 2018 02:50:54 +0200 Subject: Add another bunch of tests --- tests/test_constructor.py | 16 ++++++++++++++++ tests/test_hooks.py | 7 +++++++ tests/test_media.py | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_constructor.py b/tests/test_constructor.py index cdeb962..950845a 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py @@ -20,6 +20,22 @@ def test_constructor_illegal_ratelimit(): 'foo', client_secret='bar', ratelimit_method='baz') +def test_constructor_illegal_versioncheckmode(): + with pytest.raises(MastodonIllegalArgumentError): + api = Mastodon( + 'foo', client_secret='bar', + version_check_mode='baz') + + def test_constructor_missing_client_secret(): with pytest.raises(MastodonIllegalArgumentError): api = Mastodon('foo') + +@pytest.mark.vcr() +def test_verify_version(api): + assert api.verify_minimum_version("2.3.3") == True + assert api.verify_minimum_version("2.3.4") == False + assert api.verify_minimum_version("2.4.3") == False + assert api.verify_minimum_version("3.3.3") == False + assert api.verify_minimum_version("1.0.0") == True + \ No newline at end of file diff --git a/tests/test_hooks.py b/tests/test_hooks.py index c819d6e..f0139e5 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -29,3 +29,10 @@ def test_id_hook_within_reblog(api, status): @pytest.mark.vcr() def test_date_hook(status): assert isinstance(status['created_at'], datetime) + +@pytest.mark.vcr() +def test_attribute_access(status): + assert status.id != None + with pytest.raises(AttributeError): + status.id = 420 + \ No newline at end of file diff --git a/tests/test_media.py b/tests/test_media.py index b1cfd89..118ca4b 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -11,7 +11,7 @@ def test_media_post(api, sensitive): status = api.status_post( 'LOL check this out', - media_ids=[media], + media_ids=media, sensitive=sensitive ) -- cgit v1.2.3