Skip to content
Snippets Groups Projects
Commit c9a960f0 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

tests/test_cli: Fix test_locate_origins with dev version of swh-graph

It now requires a swh-graph server running or connection errors appear.

Use swh-graph NaiveClient to avoid spawning a real graph server during
the tests.
parent c0a4d44b
No related branches found
No related tags found
1 merge request!58tests/test_cli: Fix test_locate_origins with dev version of swh-graph
Pipeline #5573 passed
pytest_plugins = ["swh.storage.pytest_plugin", "swh.core.db.pytest_plugin"]
pytest_plugins = [
"swh.storage.pytest_plugin",
"swh.core.db.pytest_plugin",
"swh.graph.pytest_plugin",
]
......@@ -387,7 +387,6 @@ def scrubber_check_stats(ctx, name: str, config_id: int, json_format: bool):
stats = db.config_get_stats(config_id)
if json_format:
stats["config"] = asdict(stats["config"])
stats["config"]["object_type"] = stats["config"]["object_type"].name.lower()
click.echo(dumps(stats, indent=2))
......
......@@ -487,7 +487,6 @@ def test_check_stats(mocker, scrubber_db, swh_storage):
assert result.exit_code == 0, result.output
for otype in ("snapshot", "revision", "release"):
result = invoke(
scrubber_db,
["check", "stats", "--json", f"cfg_{otype}"],
......@@ -701,7 +700,7 @@ def test_check_journal(
assert journal_checker.method_calls == [call.run()]
def test_locate_origins(mocker, scrubber_db, swh_storage):
def test_locate_origins(mocker, scrubber_db, swh_storage, naive_graph_client):
origin_locator = MagicMock()
OriginLocator = mocker.patch(
"swh.scrubber.origin_locator.OriginLocator", return_value=origin_locator
......@@ -709,6 +708,11 @@ def test_locate_origins(mocker, scrubber_db, swh_storage):
get_scrubber_db = mocker.patch(
"swh.scrubber.get_scrubber_db", return_value=scrubber_db
)
mocker.patch(
"swh.graph.http_client.RemoteGraphClient",
return_value=naive_graph_client,
)
result = invoke(scrubber_db, ["locate"], storage=swh_storage)
assert result.exit_code == 0, result.output
assert result.output == ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment