def test_config(f): '''Test config process validate args, and generate envvars''' c = Config({'version': f.version, 'prog': f.prog}, args=[f.prog, 'leon', '-E="{}"'.format(f.conf)]) # Apparently clg return data out of order. Sort its output here. ret = '\n'.join(sorted(c.export().split('\n'))) exp = dedent('''\ export ARGS="" export DATA_FILE="$data_path/data.txt" export DOCKER__IMAGE="reg.gdl/debian" export EXTRA_CONFIG="" export HOST="leon" export PROG="dbuild" export SYSTEM_PATH="/data/salt/system" export VERSION="0.4.3"''') assert exp == ret
def test_export_dict(f): c = Config('Outdoor activity: {mountain: bike, ocean: scuba dive}') exp = '{Outdoor activity: {mountain: bike, ocean: scuba dive}}' assert exp == repr(c) exp = 'export OUTDOOR_ACTIVITY="{mountain: bike, ocean: scuba dive}"' assert exp == c.export()
def test_export_list(f): c = Config('Outdoor activity: [hike, bike, scuba dive, run]') exp = '{Outdoor activity: [hike, bike, scuba dive, run]}' assert exp == repr(c) exp = 'export OUTDOOR_ACTIVITY="hike bike \'scuba dive\' run"' assert exp == c.export()