Esempio n. 1
0
def test_database_store_requires_split(tmp_path) -> None:
    wallet_path = os.path.join(tmp_path, "database")
    db_store = DatabaseStore(wallet_path)
    try:
        assert not db_store.requires_split()
    finally:
        db_store.close()
Esempio n. 2
0
def test_database_store_version_init_set(tmp_path) -> None:
    wallet_path = os.path.join(tmp_path, "database")
    db_store = DatabaseStore(wallet_path)
    try:
        _check_database_store_version_init_set(db_store, MIGRATION_CURRENT)
    finally:
        db_store.close()
Esempio n. 3
0
def test_database_store_requires_split() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    try:
        assert not db_store.requires_split()
    finally:
        db_store.close()
Esempio n. 4
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()
Esempio n. 5
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()
Esempio n. 6
0
def test_database_store_version_init_set() -> None:
    wallet_path = tempfile.mktemp()
    db_store = DatabaseStore(wallet_path)
    try:
        _check_database_store_version_init_set(db_store,
                                               DatabaseStore.CURRENT_MIGRATION)
    finally:
        db_store.close()
Esempio n. 7
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()