diff options
author | Mike Crute <mcrute@gmail.com> | 2015-12-05 22:40:14 -0800 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2015-12-05 22:40:14 -0800 |
commit | 2314e33faf6265d279c53396c07740e6ee4aa5c1 (patch) | |
tree | 804f4a5851cae9f68bfa39b24d51c3e15b33fe8b /tests | |
parent | 62c15a0a45a2f2e086ba71585a0915f88ea7c337 (diff) | |
download | pydora-2314e33faf6265d279c53396c07740e6ee4aa5c1.tar.bz2 pydora-2314e33faf6265d279c53396c07740e6ee4aa5c1.tar.xz pydora-2314e33faf6265d279c53396c07740e6ee4aa5c1.zip |
Fix SysCallError test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_pandora/test_transport.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_pandora/test_transport.py b/tests/test_pandora/test_transport.py index 746a6f6..59d4cea 100644 --- a/tests/test_pandora/test_transport.py +++ b/tests/test_pandora/test_transport.py | |||
@@ -1,22 +1,24 @@ | |||
1 | import time | 1 | import time |
2 | from unittest import TestCase | 2 | from unittest import TestCase |
3 | 3 | ||
4 | from OpenSSL.SSL import SysCallError | ||
5 | |||
6 | from pandora.py2compat import Mock, call | 4 | from pandora.py2compat import Mock, call |
7 | 5 | ||
8 | from tests.test_pandora.test_clientbuilder import TestSettingsDictBuilder | 6 | from tests.test_pandora.test_clientbuilder import TestSettingsDictBuilder |
9 | 7 | ||
10 | 8 | ||
9 | class SysCallError(Exception): | ||
10 | pass | ||
11 | |||
12 | |||
11 | class TestTransport(TestCase): | 13 | class TestTransport(TestCase): |
12 | 14 | ||
13 | def test_call_should_retry_max_times_on_sys_call_error(self): | 15 | def test_call_should_retry_max_times_on_sys_call_error(self): |
14 | with self.assertRaises(SysCallError): | 16 | with self.assertRaises(SysCallError): |
15 | |||
16 | client = TestSettingsDictBuilder._build_minimal() | 17 | client = TestSettingsDictBuilder._build_minimal() |
17 | 18 | ||
18 | time.sleep = Mock() | 19 | time.sleep = Mock() |
19 | client.transport._make_http_request = Mock(side_effect=SysCallError("mock_error")) | 20 | client.transport._make_http_request = Mock( |
21 | side_effect=SysCallError("mock_error")) | ||
20 | client.transport._start_request = Mock() | 22 | client.transport._start_request = Mock() |
21 | 23 | ||
22 | client("method") | 24 | client("method") |