Ejemplo n.º 1
0
def test_set():
    setknob = Knob('KNOB_NAME', 'KNOB_VAL')
    assert setknob.get_type() == str
    assert setknob.get() == 'KNOB_VAL'

    setknob.set('XX123')
    assert setknob.get() == 'XX123'
Ejemplo n.º 2
0
def test_typle_from_env():
    os.environ['TUPLE'] = 'DEAD BEEF COFFEE'
    assert type(os.environ['TUPLE']) == str
    knob = Knob('LIST', ('LOVE', 'THEY', 'NEIGHBOUR'))
    assert knob.get_type() == tuple
    assert knob() == ('DEAD', 'BEEF', 'COFFEE')
Ejemplo n.º 3
0
def test_cast_to_string():
    rope = Knob('ROPE_TO_HANG_BY', 'A stiff rope for yer nek, mate')
    assert rope.get_type() == str
Ejemplo n.º 4
0
def test_list_from_env():
    os.environ['LIST'] = 'DEAD BEEF COFFEE'
    assert type(os.environ['LIST']) == str
    knob = Knob('LIST', ['LOVE', 'THEY', 'NEIGHBOUR'])
    assert knob.get_type() == list
    assert knob() == ['DEAD', 'BEEF', 'COFFEE']