def test_detach_no_teardown(self, model): descriptor = Mock(main=Mock(threads=4)) consumer = Mock() # test plugin = Plugin(descriptor, '') plugin.consumer = consumer plugin.detach(teardown=False) # validation consumer.shutdown.assert_called_once_with() consumer.join.assert_called_once_with() self.assertFalse(model.teardown.called) self.assertEqual(plugin.consumer, None)
def test_detach(self, model): descriptor = Mock(main=Mock(threads=4)) consumer = Mock() # test plugin = Plugin(descriptor, '') plugin.consumer = consumer plugin.detach() # validation consumer.shutdown.assert_called_once_with() consumer.join.assert_called_once_with() model.assert_called_with(plugin) model = model.return_value model.teardown.assert_called_once_with() self.assertEqual(plugin.consumer, None)