Esempio 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'
Esempio 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')
Esempio 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
Esempio 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']