Пример #1
0
def test_text_store__raise_unsupported_version() -> None:
    wallet_path = tempfile.mktemp()
    store = TextStore(wallet_path)

    with pytest.raises(Exception) as e:
        store._raise_unsupported_version(5)
    assert "To open this wallet" in e.value.args[0]

    with pytest.raises(Exception) as e:
        store._raise_unsupported_version(6)
    assert "It does not contain any keys" in e.value.args[0]

    store.put("master_public_keys", 1)

    with pytest.raises(Exception) as e:
        store._raise_unsupported_version(6)
    assert "Please open this file" in e.value.args[0]
Пример #2
0
def test_text_store__raise_unsupported_version(tmp_path) -> None:
    wallet_path = os.path.join(tmp_path, "database")
    store = TextStore(wallet_path)
    try:
        with pytest.raises(Exception) as e:
            store._raise_unsupported_version(5)
        assert "To open this wallet" in e.value.args[0]

        with pytest.raises(Exception) as e:
            store._raise_unsupported_version(6)
        assert "It does not contain any keys" in e.value.args[0]

        store.put("master_public_keys", 1)

        with pytest.raises(Exception) as e:
            store._raise_unsupported_version(6)
        assert "Please open this file" in e.value.args[0]
    finally:
        store.close()