scrubber_db = <swh.scrubber.db.ScrubberDb object at 0x7f7655136978>
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f76550fed30>
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f76550fef98>
def test_origin_not_in_storage(scrubber_db, swh_storage, caplog):
scrubber_db.corrupt_object_add(
CORRUPT_OBJECT.id, CORRUPT_OBJECT.datastore, CORRUPT_OBJECT.object_
)
origin = Origin(url="http://example.org")
graph = NaiveGraphClient(
nodes=[CORRUPT_OBJECT.id, origin.swhid()],
edges=[(origin.swhid(), CORRUPT_OBJECT.id)],
)
locator = OriginLocator(
db=scrubber_db,
graph=graph,
storage=swh_storage,
start_object=CoreSWHID.from_string("swh:1:cnt:" + "00" * 20),
end_object=CoreSWHID.from_string("swh:1:snp:" + "ff" * 20),
)
with caplog.at_level(logging.ERROR, logger="swh.scrubber.origin_locator"):
locator.run()
with scrubber_db.conn.cursor() as cur:
cur.execute("SELECT COUNT(*) FROM object_origin")
assert cur.fetchone() == (0,)
> assert any(
f"{origin.swhid()} found in graph but missing" in record[2]
for record in caplog.record_tuples
)
E assert False
E + where False = any(<generator object test_origin_not_in_storage.<locals>.<genexpr> at 0x7f76552d1a20>)
.tox/py3/lib/python3.7/site-packages/swh/scrubber/tests/test_origin_locator.py:104: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Mar 25 2022, 3:28 PM