def test_parse_env_vars_nonexistent(self): """ A none-existent environment variable will return an empty list. """ with mock.patch('os.getenv', return_value=None) as patch: actual = waffle.parse_env_vars('foo') expected = [] assert expected == actual
def test_parse_env_vars(self): """ A comma-separated list of items is turned into a ordered list. """ with mock.patch('os.getenv', return_value='foo,bar,baz') as patch: actual = waffle.parse_env_vars('foo') expected = ['foo', 'bar', 'baz'] assert expected == actual
def test_parse_env_vars_malformed(self): """ A malformed comma-separated list is "mended" appropriately (empty entries are ignored). """ with mock.patch('os.getenv', return_value='foo,,baz') as patch: actual = waffle.parse_env_vars('foo') expected = ['foo', 'baz'] assert expected == actual