Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_postgresql.py
Show First 20 Lines • Show All 385 Lines • ▼ Show 20 Lines | class TestPgStorage: | ||||
def test_clear_buffers(self, swh_storage): | def test_clear_buffers(self, swh_storage): | ||||
"""Calling clear buffers on real storage does nothing""" | """Calling clear buffers on real storage does nothing""" | ||||
assert swh_storage.clear_buffers() is None | assert swh_storage.clear_buffers() is None | ||||
def test_flush(self, swh_storage): | def test_flush(self, swh_storage): | ||||
"""Calling clear buffers on real storage does nothing""" | """Calling clear buffers on real storage does nothing""" | ||||
assert swh_storage.flush() == {} | assert swh_storage.flush() == {} | ||||
def test_dbversion(self, swh_storage): | |||||
with swh_storage.db() as db: | |||||
assert db.check_dbversion() | |||||
def test_dbversion_mismatch(self, swh_storage, monkeypatch): | |||||
monkeypatch.setattr(Db, "current_version", -1) | |||||
with swh_storage.db() as db: | |||||
assert db.check_dbversion() is False | |||||
def test_check_config(self, swh_storage): | def test_check_config(self, swh_storage): | ||||
assert swh_storage.check_config(check_write=True) | assert swh_storage.check_config(check_write=True) | ||||
assert swh_storage.check_config(check_write=False) | assert swh_storage.check_config(check_write=False) | ||||
def test_check_config_dbversion(self, swh_storage, monkeypatch): | def test_check_config_dbversion(self, swh_storage, monkeypatch): | ||||
monkeypatch.setattr(Db, "current_version", -1) | swh_storage.current_version = -1 | ||||
assert swh_storage.check_config(check_write=True) is False | assert swh_storage.check_config(check_write=True) is False | ||||
assert swh_storage.check_config(check_write=False) is False | assert swh_storage.check_config(check_write=False) is False |