python3: update json exceptions (#40012)
This commit is contained in:
parent
980da6dfd0
commit
311014371e
|
@ -8,6 +8,7 @@ import pytest
|
|||
from mock import call, patch, Mock
|
||||
from requests import Response, exceptions
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from hobo.agent.common.management.commands.hobo_deploy import (
|
||||
|
@ -104,8 +105,12 @@ def test_handle_from_scratch():
|
|||
command.deploy.reset_mock()
|
||||
with patch('hobo.agent.common.management.commands.hobo_deploy.open') as mocked_open:
|
||||
mocked_open.side_effect = [StringIO('malformated JSON')]
|
||||
with pytest.raises(ValueError, match='No JSON object could be decoded'):
|
||||
command.handle('https://combo.dev.publik.love/', 'env.json')
|
||||
if six.PY2:
|
||||
with pytest.raises(ValueError, match='No JSON object could be decoded'):
|
||||
command.handle('https://combo.dev.publik.love/', 'env.json')
|
||||
else:
|
||||
with pytest.raises(json.decoder.JSONDecodeError):
|
||||
command.handle('https://combo.dev.publik.love/', 'env.json')
|
||||
assert command.deploy.mock_calls == []
|
||||
|
||||
# missing args
|
||||
|
|
Loading…
Reference in New Issue