Skip to content

Commit

Permalink
Use json-automationrelevance instead of json-rev (#927)
Browse files Browse the repository at this point in the history
Fixes #668
  • Loading branch information
shubham-y authored Aug 30, 2021
1 parent 46d9aef commit 43beec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions backend/code_coverage_backend/hgmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand All @@ -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]

Expand Down
6 changes: 3 additions & 3 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 43beec6

Please sign in to comment.