summaryrefslogtreecommitdiffstats
path: root/taskcluster/gecko_taskgraph/test/test_files_changed.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /taskcluster/gecko_taskgraph/test/test_files_changed.py
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/gecko_taskgraph/test/test_files_changed.py')
-rw-r--r--taskcluster/gecko_taskgraph/test/test_files_changed.py46
1 files changed, 10 insertions, 36 deletions
diff --git a/taskcluster/gecko_taskgraph/test/test_files_changed.py b/taskcluster/gecko_taskgraph/test/test_files_changed.py
index 5b9a016649..389dbb4093 100644
--- a/taskcluster/gecko_taskgraph/test/test_files_changed.py
+++ b/taskcluster/gecko_taskgraph/test/test_files_changed.py
@@ -3,14 +3,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-import json
-import os
import unittest
from mozunit import main
from gecko_taskgraph import files_changed
-from gecko_taskgraph.util import hg
PARAMS = {
"head_repository": "https://hg.mozilla.org/mozilla-central",
@@ -31,40 +28,17 @@ FILES_CHANGED = [
]
-class FakeResponse:
- def json(self):
- with open(
- os.path.join(os.path.dirname(__file__), "automationrelevance.json")
- ) as f:
- return json.load(f)
-
-
-class TestGetChangedFiles(unittest.TestCase):
- def setUp(self):
- files_changed.get_changed_files.clear()
- self.old_get = hg.requests.get
-
- def fake_get(url, **kwargs):
- return FakeResponse()
-
- hg.requests.get = fake_get
-
- def tearDown(self):
- hg.requests.get = self.old_get
- files_changed.get_changed_files.clear()
-
- def test_get_changed_files(self):
- """Get_changed_files correctly gets the list of changed files in a push.
- This tests against the production hg.mozilla.org so that it will detect
- any changes in the format of the returned data."""
- self.assertEqual(
- sorted(
- files_changed.get_changed_files(
- PARAMS["head_repository"], PARAMS["head_rev"]
- )
- ),
- FILES_CHANGED,
+def test_get_changed_files(responses):
+ url = f"{PARAMS['head_repository']}/json-pushchangedfiles/{PARAMS['head_rev']}"
+ responses.add(responses.GET, url, status=200, json={"files": FILES_CHANGED})
+ assert (
+ sorted(
+ files_changed.get_changed_files(
+ PARAMS["head_repository"], PARAMS["head_rev"]
+ )
)
+ == FILES_CHANGED
+ )
class TestCheck(unittest.TestCase):