def test_set_str_value(): os.environ['TEST_PATH'] = 'tests' config = {} test = Test.from_dict_and_environment(config) assert isinstance(test.path, str) assert test.path == 'tests'
def test_set_int_value(): os.environ['TEST_NUMBER'] = '10' config = {} test = Test.from_dict_and_environment(config) assert isinstance(test.number, int) assert test.number == 10
def test_wipes_out_value(): os.environ['TEST_ENABLED'] = '' config = {'enabled': True} test = Test.from_dict_and_environment(config) assert config == {'enabled': ''} assert not test.enabled
def test_set_bool_value_false(): os.environ['TEST_ENABLED'] = 'FALSE' config = {'enabled': True} test = Test.from_dict_and_environment(config) assert isinstance(test.enabled, bool) assert not test.enabled
def test_set_list_value(): os.environ['TEST_LIST_OF_STRING'] = 'moe, larry, curly' config = {} test = Test.from_dict_and_environment(config) assert isinstance(test.list_of_string, list) assert test.list_of_string == ['moe', 'larry', 'curly']