Ejemplo n.º 1
0
def test_set_existing_key(store, capsys, monkeypatch):
    """Setting an existing key is forbidden."""

    shell = CofrShell(store=store)

    monkeypatch.setattr('cofr.cli.click.prompt', lambda x: 'reblochon')
    shell.do_put('fromage')
    captured = capsys.readouterr()

    assert 'For safety reasons' in captured.out
    assert store['fromage'] == 'camembert'
Ejemplo n.º 2
0
def test_set_new_key(store, capsys, monkeypatch):
    """Setting a new key records it's value."""

    shell = CofrShell(store=store)

    monkeypatch.setattr('cofr.cli.click.prompt', lambda x: 'Jacques Villeret')
    shell.do_put('acteur')
    captured = capsys.readouterr()

    assert 'Done!' in captured.out
    assert store['acteur'] == 'Jacques Villeret'