diff options
author | Lorenz Diener <[email protected]> | 2018-05-06 02:50:54 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2018-05-06 02:50:54 +0200 |
commit | 4b00c448f4a55859d5177c981a8fc4b388e8b5b3 (patch) | |
tree | 6ccfec5f72a32d258593dac531743e8653785af5 | |
parent | f8e209f6ff70d3be08b71b05f4cec753a9dac926 (diff) | |
download | mastodon.py-4b00c448f4a55859d5177c981a8fc4b388e8b5b3.tar.gz |
Add another bunch of tests
-rw-r--r-- | tests/test_constructor.py | 16 | ||||
-rw-r--r-- | tests/test_hooks.py | 7 | ||||
-rw-r--r-- | tests/test_media.py | 2 |
3 files changed, 24 insertions, 1 deletions
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(): | |||
20 | 'foo', client_secret='bar', | 20 | 'foo', client_secret='bar', |
21 | ratelimit_method='baz') | 21 | ratelimit_method='baz') |
22 | 22 | ||
23 | def test_constructor_illegal_versioncheckmode(): | ||
24 | with pytest.raises(MastodonIllegalArgumentError): | ||
25 | api = Mastodon( | ||
26 | 'foo', client_secret='bar', | ||
27 | version_check_mode='baz') | ||
28 | |||
29 | |||
23 | def test_constructor_missing_client_secret(): | 30 | def test_constructor_missing_client_secret(): |
24 | with pytest.raises(MastodonIllegalArgumentError): | 31 | with pytest.raises(MastodonIllegalArgumentError): |
25 | api = Mastodon('foo') | 32 | api = Mastodon('foo') |
33 | |||
34 | @pytest.mark.vcr() | ||
35 | def test_verify_version(api): | ||
36 | assert api.verify_minimum_version("2.3.3") == True | ||
37 | assert api.verify_minimum_version("2.3.4") == False | ||
38 | assert api.verify_minimum_version("2.4.3") == False | ||
39 | assert api.verify_minimum_version("3.3.3") == False | ||
40 | assert api.verify_minimum_version("1.0.0") == True | ||
41 | \ 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): | |||
29 | @pytest.mark.vcr() | 29 | @pytest.mark.vcr() |
30 | def test_date_hook(status): | 30 | def test_date_hook(status): |
31 | assert isinstance(status['created_at'], datetime) | 31 | assert isinstance(status['created_at'], datetime) |
32 | |||
33 | @pytest.mark.vcr() | ||
34 | def test_attribute_access(status): | ||
35 | assert status.id != None | ||
36 | with pytest.raises(AttributeError): | ||
37 | status.id = 420 | ||
38 | \ 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): | |||
11 | 11 | ||
12 | status = api.status_post( | 12 | status = api.status_post( |
13 | 'LOL check this out', | 13 | 'LOL check this out', |
14 | media_ids=[media], | 14 | media_ids=media, |
15 | sensitive=sensitive | 15 | sensitive=sensitive |
16 | ) | 16 | ) |
17 | 17 | ||