2015-10-05 21:50:16 +02:00
|
|
|
from __future__ import absolute_import
|
2015-10-30 21:22:51 +01:00
|
|
|
from __future__ import unicode_literals
|
2015-10-05 21:50:16 +02:00
|
|
|
|
|
|
|
import pytest
|
|
|
|
from requests.exceptions import ConnectionError
|
|
|
|
|
|
|
|
from compose.cli import errors
|
|
|
|
from compose.cli.command import friendly_error_message
|
|
|
|
from tests import mock
|
|
|
|
from tests import unittest
|
|
|
|
|
|
|
|
|
|
|
|
class FriendlyErrorMessageTestCase(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_dispatch_generic_connection_error(self):
|
|
|
|
with pytest.raises(errors.ConnectionErrorGeneric):
|
|
|
|
with mock.patch(
|
|
|
|
'compose.cli.command.call_silently',
|
|
|
|
autospec=True,
|
|
|
|
side_effect=[0, 1]
|
|
|
|
):
|
|
|
|
with friendly_error_message():
|
|
|
|
raise ConnectionError()
|