Example #1
0
 def test_repair(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     sender.repair()
     _impl.repair.assert_called_with()
Example #2
0
 def test_repair(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     sender.repair()
     _impl.repair.assert_called_with()
Example #3
0
 def test_close(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     # soft
     sender.close()
     _impl.close.assert_called_with()
Example #4
0
 def test_is_open(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     is_open = sender.is_open()
     _impl.is_open.assert_called_with()
     self.assertEqual(is_open, _impl.is_open.return_value)
Example #5
0
 def test_close(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     # soft
     sender.close()
     _impl.close.assert_called_with()
Example #6
0
 def test_is_open(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     is_open = sender.is_open()
     _impl.is_open.assert_called_with()
     self.assertEqual(is_open, _impl.is_open.return_value)
Example #7
0
 def test_send(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     address = Mock()
     content = '1234'
     ttl = 10
     sender = Sender(url)
     sender.durable = 18
     sender.send(address, content, ttl)
     _impl.send.assert_called_once_with(address, content, ttl)
     self.assertEqual(sender.durable, _impl.durable)
Example #8
0
 def test_send(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     address = Mock()
     content = '1234'
     ttl = 10
     sender = Sender(url)
     sender.durable = 18
     sender.send(address, content, ttl)
     _impl.send.assert_called_once_with(address, content, ttl)
     self.assertEqual(sender.durable, _impl.durable)
Example #9
0
 def test_init(self, _find):
     _impl = Mock()
     plugin = Mock()
     plugin.Sender.return_value = _impl
     _find.return_value = plugin
     url = TEST_URL
     sender = Sender(url)
     self.assertEqual(sender._impl, _impl)
     self.assertTrue(isinstance(sender, BaseSender))