Example #1
0
    def test_boolify(self):
        truth = 'True'
        self.assertTrue(util.boolify(truth))
        self.assertEqual(truth, 'True',
                         'Make sure boolify did not mangle the value.')

        self.assertTrue(util.boolify('true'))

        self.assertFalse(util.boolify('False'))
        self.assertFalse(util.boolify('false'))
        self.assertFalse(util.boolify('anything_else'))
Example #2
0
    def test_boolify(self):
        truth = 'True'
        self.assertTrue(util.boolify(truth))
        self.assertEqual(truth, 'True',
                         'Make sure boolify did not mangle the value.')

        self.assertTrue(util.boolify('true'))

        self.assertFalse(util.boolify('False'))
        self.assertFalse(util.boolify('false'))
        self.assertFalse(util.boolify('anything_else'))
Example #3
0
    def _load_from_environment(self):
        '''Load any config options from the environment if they exist.'''
        for key in sorted(self.config.keys()):
            if os.environ.get(key) is not None:
                print('Using \'{key}\' from environment ...'.format(key=key))

                if key in self.boolean_settings:
                    self.config[key] = util.boolify(os.environ[key])
                else:
                    self.config[key] = os.environ[key]
Example #4
0
    def _load_from_environment(self):
        '''Load any config options from the environment if they exist.'''
        for key in sorted(self.config.keys()):
            if os.environ.get(key) is not None:
                print('Using \'{key}\' from environment ...'.format(key=key))

                if key in self.boolean_settings:
                    self.config[key] = util.boolify(os.environ[key])
                else:
                    self.config[key] = os.environ[key]