failing test for #160

This commit is contained in:
codl 2019-03-11 14:50:23 +01:00
pare 8b86269787
commit 3f83ee0a4c
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 6CD7C8891ED1233A

20
tests/test_errors.py Normal file
Veure arxiu

@ -0,0 +1,20 @@
import pytest
from mastodon.Mastodon import MastodonAPIError
import re
try:
from mock import MagicMock
except ImportError:
from unittest.mock import MagicMock
def test_nonstandard_errors(api):
response = MagicMock()
response.json = MagicMock(return_value=
"I am a non-standard instance and this error is a plain string.")
response.ok = False
session = MagicMock()
session.request = MagicMock(return_value=response)
api.session = session
with pytest.raises(MastodonAPIError):
api.instance()