def test_stopService(self): callback = mock.Mock() service = FedoraMessagingService(callback) serv = mock.Mock() service.addService(serv) service.stopService() serv.factory.stopTrying.assert_called_once()
def test_stopService_no_factory(self): service = FedoraMessagingService(None) ss_path = ("fedora_messaging.twisted.service.service." "MultiService.stopService") with mock.patch(ss_path) as stopService: service.stopService() stopService.assert_not_called()