Exemplo n.º 1
0
    def test_testing_default(self):
        """
            Make sure the testing profile is used when needed.
        """
        app = ProfileApp().init(use_test_profile=True)
        assert app.config['PROFILE_FROM'] == 'testing-default'

        app = ProfileApp.testing_prep()
        assert app.config['PROFILE_FROM'] == 'testing-default'
Exemplo n.º 2
0
    def test_environment(self):
        """
            The environment override should work even when in a testing context.
        """
        kwargs = {'KEG_APPS_PROFILE_CONFIG_PROFILE': 'EnvironmentProfile'}
        with mock.patch.dict(os.environ, **kwargs):
            app = ProfileApp().init()
            assert app.config['PROFILE_FROM'] == 'environment'

            app = ProfileApp().init(use_test_profile=True)
            assert app.config['PROFILE_FROM'] == 'environment'
Exemplo n.º 3
0
 def test_config_file_default(self):
     """
         No explicit profile and no environment value results in the default coming from
         configuration profiles.
     """
     app = ProfileApp().init()
     assert app.config['PROFILE_FROM'] == 'config-file-default'
Exemplo n.º 4
0
 def test_app_init(self):
     """ Even with an environment set, the explict value passed into init() should override. """
     # the direct setting should override the environment
     kwargs = {'KEG_APPS.PROFILE_CONFIG_PROFILE': 'EnvironmentProfile'}
     with mock.patch.dict(os.environ, **kwargs):
         app = ProfileApp().init(config_profile='AppInitProfile', use_test_profile=True)
     assert app.config['PROFILE_FROM'] == 'app-init'