def test_application_defaults(self): new_proxy = ApplicationDefaultsProxy() assert new_proxy.application_defaults == DotDict() new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp' ) assert dict(new_proxy.application_defaults) == {'alpha': 17, 'beta': 23}
def test_get_values(self): new_proxy = ApplicationDefaultsProxy() vs = ValueSource(new_proxy) assert vs.get_values(None, None, dict) == {} assert vs.get_values(None, None, DotDict) == DotDict() new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp') assert vs.get_values(None, None, dict) == {'alpha': 17, 'beta': 23} assert isinstance(vs.get_values(None, None, DotDict), DotDict)
def test_application_defaults(self): new_proxy = ApplicationDefaultsProxy() eq_(new_proxy.application_defaults, DotDict()) new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp') eq_(dict(new_proxy.application_defaults), { 'alpha': 17, 'beta': 23, })
def test_application_defaults(self): new_proxy = ApplicationDefaultsProxy() assert new_proxy.application_defaults == DotDict() new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp') assert dict(new_proxy.application_defaults) == { 'alpha': 17, 'beta': 23 }
def test_get_values(self): new_proxy = ApplicationDefaultsProxy() vs = ValueSource(new_proxy) assert vs.get_values(None, None, dict) == {} assert vs.get_values(None, None, DotDict) == DotDict() new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp' ) assert vs.get_values(None, None, dict) == {'alpha': 17, 'beta': 23} assert isinstance(vs.get_values(None, None, DotDict), DotDict)
def test_application_defaults(self): new_proxy = ApplicationDefaultsProxy() eq_(new_proxy.application_defaults, DotDict()) new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp' ) eq_( dict(new_proxy.application_defaults), { 'alpha': 17, 'beta': 23, } )
class TestApplicationDefaultsProxy(TestCase): def setUp(self): self.proxy = ApplicationDefaultsProxy() def test_app_converter(self): eq_( self.proxy.str_to_application_class('CollectorApp'), class_converter('socorro.collector.collector_app.CollectorApp') ) eq_( self.proxy.str_to_application_class('CrashMoverApp'), class_converter('socorro.collector.crashmover_app.CrashMoverApp') ) eq_( self.proxy.str_to_application_class('SubmitterApp'), class_converter('socorro.collector.submitter_app.SubmitterApp') ) #eq_( #self.proxy.str_to_application_class('CronTabberApp'), #class_converter('socorro.cron.crontabber_app.CronTabberApp') #) eq_( self.proxy.str_to_application_class('MiddlewareApp'), class_converter('socorro.middleware.middleware_app.MiddlewareApp') ) eq_( self.proxy.str_to_application_class('ProcessorApp'), class_converter('socorro.processor.processor_app.ProcessorApp') ) eq_( self.proxy.str_to_application_class('HBaseClientApp'), class_converter('socorro.external.hb.hbase_client.HBaseClientApp') ) eq_( self.proxy.str_to_application_class( 'socorro.external.hb.hbase_client.HBaseClientApp' ), class_converter('socorro.external.hb.hbase_client.HBaseClientApp') ) def test_application_defaults(self): new_proxy = ApplicationDefaultsProxy() eq_(new_proxy.application_defaults, DotDict()) new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp' ) eq_( dict(new_proxy.application_defaults), { 'alpha': 17, 'beta': 23, } )
class TestApplicationDefaultsProxy(TestCase): def setUp(self): self.proxy = ApplicationDefaultsProxy() def test_app_converter(self): eq_( self.proxy.str_to_application_class('collector'), class_converter('socorro.collector.collector_app.CollectorApp') ) eq_( self.proxy.str_to_application_class('crashmover'), class_converter('socorro.collector.crashmover_app.CrashMoverApp') ) eq_( self.proxy.str_to_application_class('submitter'), class_converter('socorro.collector.submitter_app.SubmitterApp') ) #eq_( #self.proxy.str_to_application_class('crontabber'), #class_converter('socorro.cron.crontabber_app.CronTabberApp') #) eq_( self.proxy.str_to_application_class('middleware'), class_converter('socorro.middleware.middleware_app.MiddlewareApp') ) eq_( self.proxy.str_to_application_class('processor'), class_converter('socorro.processor.processor_app.ProcessorApp') ) eq_( self.proxy.str_to_application_class( 'socorro.external.hb.hbase_client.HBaseClientApp' ), class_converter('socorro.external.hb.hbase_client.HBaseClientApp') ) def test_application_defaults(self): new_proxy = ApplicationDefaultsProxy() eq_(new_proxy.application_defaults, DotDict()) new_proxy.str_to_application_class( 'socorro.unittest.app.test_for_application_defaults.SomeApp' ) eq_( dict(new_proxy.application_defaults), { 'alpha': 17, 'beta': 23, } )
def setUp(self): self.proxy = ApplicationDefaultsProxy()
# application has been determined, fetch the defaults. Since the # ApplicationDefaultsProxy object is already in the values source list, it can # then start providing overlay values immediately. # Configman knows nothing about how the ApplicationDefaultsProxy object works, # so we must regisiter it as a new values overlay source class. We do that # by manually inserting inserting the new class into Configman's # handler/dispatcher. That object associates config sources with modules that # are able to implement Configman's overlay handlers. from configman.value_sources import type_handler_dispatch # register our new type handler with configman type_handler_dispatch[ApplicationDefaultsProxy].append( socorro.app.for_application_defaults) # create the app default proxy object application_defaults_proxy = ApplicationDefaultsProxy() # for use with SIGHUP for apps that run as daemons restart = True def respond_to_SIGHUP(signal_number, frame, logger=None): """raise the KeyboardInterrupt which will cause the app to effectively shutdown, closing all it resources. Then, because it sets 'restart' to True, the app will reread all the configuration information, rebuild all of its structures and resources and start running again""" global restart restart = True if logger: logger.info('detected SIGHUP') raise KeyboardInterrupt