diff --git a/backend/code_coverage_backend/hgmo.py b/backend/code_coverage_backend/hgmo.py index 104f04aa6..98fbe6795 100644 --- a/backend/code_coverage_backend/hgmo.py +++ b/backend/code_coverage_backend/hgmo.py @@ -13,7 +13,9 @@ __hgmo: Dict[str, Tuple[int, float]] = {} -HGMO_REVISION_URL = "https://hg.mozilla.org/{repository}/json-rev/{revision}" +HGMO_REVISION_URL = ( + "https://hg.mozilla.org/{repository}/json-automationrelevance/{revision}" +) HGMO_PUSHES_URL = "https://hg.mozilla.org/{repository}/json-pushes" @@ -29,7 +31,8 @@ def hgmo_revision_details(repository, changeset): url = HGMO_REVISION_URL.format(repository=repository, revision=changeset) resp = requests.get(url) resp.raise_for_status() - data = resp.json() + assert "changesets" in resp.json(), "Missing changesets" + data = resp.json()["changesets"][-1] assert "pushid" in data, "Missing pushid" out = data["pushid"], data["date"][0] diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index 4d3e8f7a8..e17430656 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -144,9 +144,9 @@ def mock_hgmo(): def _test_rev(request): # The push id is in the first 3 characters of the revision requested - revision = request.path_url[17:] + revision = request.path_url[33:] assert len(revision) == 32 - resp = {"pushid": int(revision[:3]), "date": [time.time(), 0]} + resp = {"changesets": [{"pushid": int(revision[:3]), "date": [time.time(), 0]}]} return (200, headers, json.dumps(resp)) def _changesets(push_id): @@ -185,7 +185,7 @@ def _test_pushes(request): with responses.RequestsMock(assert_all_requests_are_fired=False) as resps: resps.add_callback( responses.GET, - re.compile("https://hg.mozilla.org/(.+)/json-rev/(.+)"), + re.compile("https://hg.mozilla.org/(.+)/json-automationrelevance/(.+)"), callback=_test_rev, ) resps.add_callback(