Exemplo n.º 1
0
def test_database_store_version_requires_upgrade_not_esv_wallet() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    db_store._set_seed_version(DatabaseStore.INITIAL_SEED_VERSION)
    db_store.write()
    # Missing "ESV" marker.
    with pytest.raises(IncompatibleWalletError):
        db_store.requires_upgrade()
Exemplo n.º 2
0
def test_database_store_version_requires_upgrade(tmp_path) -> None:
    wallet_path = os.path.join(tmp_path, "database")
    db_store = DatabaseStore(wallet_path)
    try:
        db_store.put("migration", DatabaseStore.INITIAL_MIGRATION - 1)
        assert db_store.requires_upgrade()
    finally:
        db_store.close()
Exemplo n.º 3
0
def test_database_store_version_requires_upgrade() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    try:
        db_store.put("migration", DatabaseStore.INITIAL_MIGRATION - 1)
        assert db_store.requires_upgrade()
    finally:
        db_store.close()
Exemplo n.º 4
0
def test_database_store_version_requires_upgrade_esv_wallet() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    db_store._set_seed_version(DatabaseStore.INITIAL_SEED_VERSION)
    db_store.put("wallet_author", "ESV")
    db_store.write()
    # "ESV" marker present.
    assert db_store.requires_upgrade()
Exemplo n.º 5
0
def test_database_store_new_never_requires_upgrade(tmp_path) -> None:
    wallet_path = os.path.join(tmp_path, "database")
    db_store = DatabaseStore(wallet_path)
    try:
        # At this time this is not linked to anything as database storage upgrades internally.
        # However, we may need to extend it as the JSON lump contents change.
        assert not db_store.requires_upgrade()
    finally:
        db_store.close()
Exemplo n.º 6
0
def test_database_store_version_requires_upgrade() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    db_store._set_seed_version(DatabaseStore.INITIAL_SEED_VERSION - 1)
    with pytest.raises(IncompatibleWalletError):
        db_store.requires_upgrade()
Exemplo n.º 7
0
def test_database_store_new_never_requires_upgrade() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    # At this time this is not linked to anything as database storage upgrades internally.
    # However, we may need to extend it as the JSON lump contents change.
    assert not db_store.requires_upgrade()