aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-27 23:49:14 +0100
committercodl <[email protected]>2017-11-27 23:49:14 +0100
commit38f99480dbeb6222ff8102163cfeca64634217a5 (patch)
tree38d24aeb106556cb25a48f69ab5c1eeddc49adbf /tests/test_media.py
parentc73fd26729e8266374bc89f50cae5c429bf6122e (diff)
downloadmastodon.py-38f99480dbeb6222ff8102163cfeca64634217a5.tar.gz
add tests for media
Diffstat (limited to 'tests/test_media.py')
-rw-r--r--tests/test_media.py31
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 @@
1import pytest
2
3@pytest.mark.vcr(match_on=['path'])
4@pytest.mark.parametrize('sensitive', (False, True))
5def 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'])
28def 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
Powered by cgit v1.2.3 (git 2.41.0)