Skip to content

Commit 0a57c4f

Browse files
committed
Adds tests on shared hosts
1 parent 33ff7a9 commit 0a57c4f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/features/http/test_requester.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ def test_http_error_exception(self):
2020

2121
exception = cm.exception
2222
self.assertEqual(exception.status_code, 400)
23+
self.assertEqual(str(exception),
24+
'Invalid object attributes: zadaz near line:1 column:8')

tests/unit/http/test_transporter.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ def test_unreachable_hosts_exception(self):
101101
# Remains 4, all hosts here down.
102102
self.assertEqual(self.requester.send.call_count, 4)
103103

104+
with self.assertRaises(AlgoliaUnreachableHostException) as _:
105+
self.transporter.write('get', 'endpoint/bar', {},
106+
self.request_options)
107+
108+
# It's now 5, write have one different host.
109+
self.assertEqual(self.requester.send.call_count, 5)
110+
111+
with self.assertRaises(AlgoliaUnreachableHostException) as _:
112+
self.transporter.write('get', 'endpoint/bar', {},
113+
self.request_options)
114+
115+
# Remains 5, all hosts here down.
116+
self.assertEqual(self.requester.send.call_count, 5)
117+
104118
def test_algolia_exception(self):
105119
self.requester.send.return_value = Response(401, {'foo': 'bar'})
106120

0 commit comments

Comments
 (0)