예제 #1
0
    def test_runner_inputs(self):
        """
        The runner function should honor inputs.
        """
        with nested(
                mock.patch('reworker.worker.pika'),
                mock.patch('reworker.worker.logging')):
            sys.argv = ['', 'examples/mqconf.json']
            dummy = mock.Mock(worker.Worker)
            worker.runner(dummy)

            dummy.assert_called_once_with(
                json.load(open('examples/mqconf.json', 'r')),
                config_file=None)

            assert dummy().run_forever.call_count == 1

            # With output dir
            dummy.reset_mock()
            sys.argv = ['', 'examples/mqconf.json']
            worker.runner(dummy)

            dummy.assert_called_once_with(
                json.load(open('examples/mqconf.json', 'r')),
                config_file=None)

            assert dummy().run_forever.call_count == 1

            # With a worker config
            dummy.reset_mock()
            sys.argv = [
                '', 'examples/mqconf.json', '-w', 'examples/mqconf.json']
            worker.runner(dummy)

            dummy.assert_called_once_with(
                json.load(open('examples/mqconf.json', 'r')),
                config_file='examples/mqconf.json')

            assert dummy().run_forever.call_count == 1
예제 #2
0
def main():  # pragma: no cover
    from reworker.worker import runner
    runner(SleepWorker)
예제 #3
0
def main():  # pragma nocover
    from reworker.worker import runner

    runner(IRCNotifyWorker)
예제 #4
0
def main():  # pragma: no cover
    from reworker.worker import runner
    runner(OutputWorker)
예제 #5
0
def main():  # pragma: no cover
    from reworker.worker import runner
    runner(HTTPRequestWorker)
예제 #6
0
def main():  # pragma: no cover
    logging.getLogger('pika').setLevel(logging.CRITICAL)
    logging.getLogger('pika.channel').setLevel(logging.CRITICAL)

    from reworker.worker import runner
    runner(JuicerWorker)
예제 #7
0
def main():  # pragma: no cover
    logging.getLogger('pika').setLevel(logging.CRITICAL)
    logging.getLogger('pika.channel').setLevel(logging.CRITICAL)

    from reworker.worker import runner
    runner(JuicerWorker)
예제 #8
0
def main():  # pragma nocover
    from reworker.worker import runner
    runner(NagiosWorker)
예제 #9
0
def main():  # pragma nocover
    from reworker.worker import runner
    runner(NagiosWorker)
예제 #10
0
def main():  # pragma: no cover
    from reworker.worker import runner
    runner(ServiceNowWorker)
예제 #11
0
def main():  # pragma: no cover
    from reworker.worker import runner
    runner(NoopWorker)
예제 #12
0
def main():  # pragma: no cover
    from reworker.worker import runner
    runner(Satellite5Worker)