Exemple #1
0
def main():  # pragma: no cover
    """
    Main entry point.
    """
    import argparse

    parser = argparse.ArgumentParser()
    add_service_arguments(parser)

    args = parser.parse_args()

    try:
        service = InvestigatorService(exchange_name=args.bus_exchange,
                                      connection_url=args.bus_uri,
                                      config_file=args.config_file)
        service.run()
    except KeyboardInterrupt:
        pass
Exemple #2
0
    def test_add_service_arguments(self):
        """
        Verify arguments and defaults common to all services.
        """
        parser = argparse.ArgumentParser()
        add_service_arguments(parser)
        args = parser.parse_args(args=[])

        # Check for common arguments.
        self.assertEqual(len(vars(args)), 3)
        self.assertTrue(hasattr(args, 'config_file'))
        self.assertTrue(hasattr(args, 'bus_exchange'))
        self.assertTrue(hasattr(args, 'bus_uri'))

        # Check for presence of defaults.
        self.assertIsNone(args.config_file)
        self.assertIsNone(args.bus_uri)
        self.assertIsNotNone(args.bus_exchange)