Beispiel #1
0
def test_exchange_keys_works(upstream):
    """
    The Wormhole.exchange_keys method should resolve into a verifier coming
    from the upstream if all goes well.
    """
    upstream.get_verifier = lambda: succeed('verifier')

    wormhole = Wormhole()
    res = yield wormhole.exchange_keys()
    assert res == 'verifier'
Beispiel #2
0
def test_exchange_keys_bad_code(upstream):
    """
    The Wormhole.exchange_keys method should be able to handle the upstream's
    WrongPasswordError.
    """
    upstream.get_verifier = lambda: fail(WrongPasswordError())

    wormhole = Wormhole()
    with pytest.raises(HumanError):
        yield wormhole.exchange_keys()