Esempio n. 1
0
 def test_close_failed(self):
     url = 'test-url'
     c = Connection(url)
     impl = Mock()
     impl.close.side_effect = ValueError
     c._impl = impl
     c.close()
Esempio n. 2
0
 def test_close(self):
     url = 'test-url'
     c = Connection(url)
     impl = Mock()
     c._impl = impl
     c.close()
     impl.close.assert_called_once_with()
     self.assertEqual(c._impl, None)
Esempio n. 3
0
 def test_channel(self):
     url = TEST_URL
     c = Connection(url)
     c._impl = Mock()
     ch = c.channel()
     self.assertEqual(ch, c._impl.channel.return_value)
Esempio n. 4
0
 def test_open_already(self):
     url = TEST_URL
     c = Connection(url)
     c._impl = Mock()
     c.open()
     self.assertFalse(c._impl.open.called)