Esempio n. 1
0
 def test_close(self):
     url = Mock()
     messenger = Endpoint(url)
     messenger.connection = Mock()
     messenger.channel = Mock()
     messenger.close()
     messenger.channel.close.assert_called_once_with()
Esempio n. 2
0
 def test_open(self):
     url = Mock()
     messenger = Endpoint(url)
     messenger.open()
     messenger.connection.open.assert_called_once_with()
     self.assertEqual(messenger.channel,
                      messenger.connection.channel.return_value)
Esempio n. 3
0
 def test_repair(self):
     url = Mock()
     messenger = Endpoint(url)
     messenger.repair()
     messenger.connection.close.assert_called_once_with()
     messenger.connection.open.assert_called_once_with()
     self.assertEqual(messenger.channel, messenger.connection.channel.return_value)
Esempio n. 4
0
 def test_close_failed(self):
     url = Mock()
     messenger = Endpoint(url)
     messenger.connection = Mock()
     messenger.channel = Mock()
     messenger.channel.close.side_effect = ValueError
     messenger.close()
     messenger.channel.close.assert_called_once_with()
Esempio n. 5
0
 def test_close(self):
     url = Mock()
     messenger = Endpoint(url)
     messenger.connection = Mock()
     messenger.channel = Mock()
     messenger.close()
     messenger.channel.close.assert_called_once_with()
Esempio n. 6
0
 def test_close_failed(self):
     url = Mock()
     messenger = Endpoint(url)
     messenger.connection = Mock()
     messenger.channel = Mock()
     messenger.channel.close.side_effect = ValueError
     messenger.close()
     messenger.channel.close.assert_called_once_with()
Esempio n. 7
0
 def test_is_open(self):
     url = Mock()
     messenger = Endpoint(url)
     self.assertTrue(messenger.is_open())
Esempio n. 8
0
 def test_init(self, connection):
     url = Mock()
     messenger = Endpoint(url)
     connection.assert_called_once_with(url)
     self.assertEqual(messenger.connection, connection.return_value)
     self.assertEqual(messenger.channel, None)
Esempio n. 9
0
 def test_is_open(self):
     url = Mock()
     messenger = Endpoint(url)
     self.assertTrue(messenger.is_open())