diff options
author | Lorenz Diener <[email protected]> | 2017-11-29 17:48:56 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-11-29 17:48:56 +0100 |
commit | 961425e2abc91d693004f2c0d073e387de64e58c (patch) | |
tree | 8b1512daf97ab63b54f4edebc83b35f524571c53 /tests/test_media.py | |
parent | 5b811b719d379be06ed256da2ee806a051461795 (diff) | |
parent | e79987df2410ee32302abed9e486a72b2dfc9707 (diff) | |
download | mastodon.py-961425e2abc91d693004f2c0d073e387de64e58c.tar.gz |
Merge pull request #109 from codl/test-suite
Test suite
Diffstat (limited to 'tests/test_media.py')
-rw-r--r-- | tests/test_media.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_media.py b/tests/test_media.py new file mode 100644 index 0000000..b1cfd89 --- /dev/null +++ b/tests/test_media.py | |||
@@ -0,0 +1,31 @@ | |||
1 | import pytest | ||
2 | |||
3 | @pytest.mark.vcr(match_on=['path']) | ||
4 | @pytest.mark.parametrize('sensitive', (False, True)) | ||
5 | def test_media_post(api, sensitive): | ||
6 | media = api.media_post( | ||
7 | 'tests/image.jpg', | ||
8 | description="John Lennon doing a funny walk") | ||
9 | |||
10 | assert media | ||
11 | |||
12 | status = api.status_post( | ||
13 | 'LOL check this out', | ||
14 | media_ids=[media], | ||
15 | sensitive=sensitive | ||
16 | ) | ||
17 | |||
18 | assert status | ||
19 | |||
20 | try: | ||
21 | assert status['sensitive'] == sensitive | ||
22 | assert status['media_attachments'] | ||
23 | assert status['media_attachments'][0]['description'] | ||
24 | finally: | ||
25 | api.status_delete(status['id']) | ||
26 | |||
27 | @pytest.mark.vcr(match_on=['path']) | ||
28 | def test_media_post_file(api): | ||
29 | with open('tests/image.jpg', 'rb') as f: | ||
30 | media = api.media_post(f, mime_type='image/jpeg') | ||
31 | assert media | ||