aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2019-03-11 14:50:23 +0100
committercodl <[email protected]>2019-03-11 14:50:23 +0100
commit3f83ee0a4ca9d843472f69cbb9a962504950470c (patch)
tree0509f2f43e1efbcbd58dda3ab113c362a8668b50
parent8b8626978752baf14347498640b2319db832145e (diff)
downloadmastodon.py-3f83ee0a4ca9d843472f69cbb9a962504950470c.tar.gz
failing test for #160
-rw-r--r--tests/test_errors.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_errors.py b/tests/test_errors.py
new file mode 100644
index 0000000..77230c6
--- /dev/null
+++ b/tests/test_errors.py
@@ -0,0 +1,20 @@
1import pytest
2from mastodon.Mastodon import MastodonAPIError
3import re
4try:
5 from mock import MagicMock
6except ImportError:
7 from unittest.mock import MagicMock
8
9def test_nonstandard_errors(api):
10 response = MagicMock()
11 response.json = MagicMock(return_value=
12 "I am a non-standard instance and this error is a plain string.")
13 response.ok = False
14 session = MagicMock()
15 session.request = MagicMock(return_value=response)
16
17 api.session = session
18 with pytest.raises(MastodonAPIError):
19 api.instance()
20
Powered by cgit v1.2.3 (git 2.41.0)