2020-08-15 20:51:02 +00:00
|
|
|
from unittest.mock import Mock, patch
|
2012-03-20 14:53:00 +00:00
|
|
|
|
2016-08-22 18:17:59 +00:00
|
|
|
from kombu import transport
|
2013-09-12 12:10:42 +00:00
|
|
|
|
|
|
|
|
2016-08-22 18:17:59 +00:00
|
|
|
class test_supports_librabbitmq:
|
2013-09-12 12:10:42 +00:00
|
|
|
|
|
|
|
def test_eventlet(self):
|
|
|
|
with patch('kombu.transport._detect_environment') as de:
|
|
|
|
de.return_value = 'eventlet'
|
2016-08-22 18:17:59 +00:00
|
|
|
assert not transport.supports_librabbitmq()
|
2010-11-09 14:27:43 +00:00
|
|
|
|
|
|
|
|
2016-08-22 18:17:59 +00:00
|
|
|
class test_transport:
|
2010-11-09 14:27:43 +00:00
|
|
|
|
2013-09-12 12:10:42 +00:00
|
|
|
def test_resolve_transport(self):
|
2012-09-12 12:59:29 +00:00
|
|
|
from kombu.transport.memory import Transport
|
2016-08-22 18:17:59 +00:00
|
|
|
assert transport.resolve_transport(
|
|
|
|
'kombu.transport.memory:Transport') is Transport
|
|
|
|
assert transport.resolve_transport(Transport) is Transport
|
2013-09-12 12:10:42 +00:00
|
|
|
|
|
|
|
def test_resolve_transport_alias_callable(self):
|
|
|
|
m = transport.TRANSPORT_ALIASES['George'] = Mock(name='lazyalias')
|
|
|
|
try:
|
|
|
|
transport.resolve_transport('George')
|
|
|
|
m.assert_called_with()
|
|
|
|
finally:
|
|
|
|
transport.TRANSPORT_ALIASES.pop('George')
|
|
|
|
|
|
|
|
def test_resolve_transport_alias(self):
|
2016-08-22 18:17:59 +00:00
|
|
|
assert transport.resolve_transport('pyamqp')
|