Introducing DummyConnectionPool for when only 1 connection defined

This commit is contained in:
Honza Král
2014-12-20 00:35:24 +01:00
parent 82a32540d7
commit 836c6d1933
6 changed files with 49 additions and 14 deletions
+5 -1
View File
@@ -1,11 +1,15 @@
import time
from elasticsearch.connection_pool import ConnectionPool, RoundRobinSelector
from elasticsearch.connection_pool import ConnectionPool, RoundRobinSelector, DummyConnectionPool
from elasticsearch.exceptions import ImproperlyConfigured
from .test_cases import TestCase
class TestConnectionPool(TestCase):
def test_dummy_cp_raises_exception_on_more_connections(self):
self.assertRaises(ImproperlyConfigured, DummyConnectionPool, [])
self.assertRaises(ImproperlyConfigured, DummyConnectionPool, [object(), object()])
def test_raises_exception_when_no_connections_defined(self):
self.assertRaises(ImproperlyConfigured, ConnectionPool, [])