aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_status_empty.yaml29
-rw-r--r--tests/test_hooks.py1
-rw-r--r--tests/test_status.py9
3 files changed, 36 insertions, 3 deletions
diff --git a/tests/cassettes/test_status_empty.yaml b/tests/cassettes/test_status_empty.yaml
new file mode 100644
index 0000000..52be5c4
--- /dev/null
+++ b/tests/cassettes/test_status_empty.yaml
@@ -0,0 +1,29 @@
1interactions:
2- request:
3 body: !!python/unicode status=&visibility=
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['19']
10 Content-Type: [application/x-www-form-urlencoded]
11 User-Agent: [python-requests/2.18.4]
12 method: POST
13 uri: http://localhost:3000/api/v1/statuses
14 response:
15 body: {string: "{\"error\":\"\u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u306B\u5931\u6557\u3057\u307E\u3057\u305F:
16 Text\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\"}"}
17 headers:
18 cache-control: [no-cache]
19 content-length: ['87']
20 content-type: [application/json; charset=utf-8]
21 transfer-encoding: [chunked]
22 vary: ['Accept-Encoding, Origin']
23 x-content-type-options: [nosniff]
24 x-frame-options: [SAMEORIGIN]
25 x-request-id: [b28457db-8446-42ac-b5a8-241d0a7434b4]
26 x-runtime: ['0.109104']
27 x-xss-protection: [1; mode=block]
28 status: {code: 422, message: Unprocessable Entity}
29version: 1
diff --git a/tests/test_hooks.py b/tests/test_hooks.py
index 905672d..c819d6e 100644
--- a/tests/test_hooks.py
+++ b/tests/test_hooks.py
@@ -7,7 +7,6 @@ def test_id_hook(status):
7 assert isinstance(status['id'], int) 7 assert isinstance(status['id'], int)
8 8
9 9
10@pytest.mark.xfail(reason='fixed in upstream')
11@pytest.mark.vcr() 10@pytest.mark.vcr()
12def test_id_hook_in_reply_to(api, status): 11def test_id_hook_in_reply_to(api, status):
13 reply = api.status_post('Reply!', in_reply_to_id=status['id']) 12 reply = api.status_post('Reply!', in_reply_to_id=status['id'])
diff --git a/tests/test_status.py b/tests/test_status.py
index ab8540f..b177517 100644
--- a/tests/test_status.py
+++ b/tests/test_status.py
@@ -5,7 +5,12 @@ from time import sleep
5@pytest.mark.vcr() 5@pytest.mark.vcr()
6def test_status(status, api): 6def test_status(status, api):
7 status2 = api.status(status['id']) 7 status2 = api.status(status['id'])
8 assert status2 == status 8 assert status2
9
10@pytest.mark.vcr()
11def test_status_empty(api):
12 with pytest.raises(MastodonAPIError):
13 api.status_post('')
9 14
10@pytest.mark.vcr() 15@pytest.mark.vcr()
11def test_status_missing(api): 16def test_status_missing(api):
@@ -45,7 +50,7 @@ def test_toot(api):
45 50
46@pytest.mark.vcr() 51@pytest.mark.vcr()
47@pytest.mark.parametrize('visibility', ('', 'direct', 'private', 'unlisted', 'public', 52@pytest.mark.parametrize('visibility', ('', 'direct', 'private', 'unlisted', 'public',
48 pytest.param('foobar', marks=pytest.mark.xfail()))) 53 pytest.param('foobar', marks=pytest.mark.xfail(strict=True))))
49@pytest.mark.parametrize('spoiler_text', (None, 'Content warning')) 54@pytest.mark.parametrize('spoiler_text', (None, 'Content warning'))
50def test_status_post(api, visibility, spoiler_text): 55def test_status_post(api, visibility, spoiler_text):
51 status = api.status_post( 56 status = api.status_post(
Powered by cgit v1.2.3 (git 2.41.0)