예제 #1
0
 def test_uri_passthrough(self):
     transport = Mock(name='transport')
     with patch('kombu.connection.get_transport_cls') as gtc:
         gtc.return_value = transport
         transport.can_parse_url = True
         with patch('kombu.connection.parse_url') as parse_url:
             c = Connection('foo+mysql://some_host')
             assert c.transport_cls == 'foo'
             parse_url.assert_not_called()
             assert c.hostname == 'mysql://some_host'
             assert c.as_uri().startswith('foo+')
         with patch('kombu.connection.parse_url') as parse_url:
             c = Connection('mysql://some_host', transport='foo')
             assert c.transport_cls == 'foo'
             parse_url.assert_not_called()
             assert c.hostname == 'mysql://some_host'
     c = Connection('pyamqp+sqlite://some_host')
     assert c.as_uri().startswith('pyamqp+')
예제 #2
0
 def test_uri_passthrough(self):
     transport = Mock(name='transport')
     with patch('kombu.connection.get_transport_cls') as gtc:
         gtc.return_value = transport
         transport.can_parse_url = True
         with patch('kombu.connection.parse_url') as parse_url:
             c = Connection('foo+mysql://some_host')
             self.assertEqual(c.transport_cls, 'foo')
             parse_url.assert_not_called()
             self.assertEqual(c.hostname, 'mysql://some_host')
             self.assertTrue(c.as_uri().startswith('foo+'))
         with patch('kombu.connection.parse_url') as parse_url:
             c = Connection('mysql://some_host', transport='foo')
             self.assertEqual(c.transport_cls, 'foo')
             parse_url.assert_not_called()
             self.assertEqual(c.hostname, 'mysql://some_host')
     c = Connection('pyamqp+sqlite://some_host')
     self.assertTrue(c.as_uri().startswith('pyamqp+'))