This commit is contained in:
parent
9f1e0b8ae9
commit
ef55b5b947
@ -30,14 +30,42 @@ class TestCli(unittest.TestCase):
|
|||||||
|
|
||||||
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
||||||
def test_pr_single_simple(self, mock_get):
|
def test_pr_single_simple(self, mock_get):
|
||||||
result = runner.invoke(app, ["pr", "345583"])
|
result = runner.invoke(
|
||||||
|
app,
|
||||||
|
[
|
||||||
|
"pr",
|
||||||
|
"--format",
|
||||||
|
"json",
|
||||||
|
"--branches",
|
||||||
|
"nixos-unstable-small",
|
||||||
|
"--branches",
|
||||||
|
"nixos-unstable",
|
||||||
|
"--branches",
|
||||||
|
"nixos-24.11",
|
||||||
|
"345583",
|
||||||
|
],
|
||||||
|
)
|
||||||
print(result.exception)
|
print(result.exception)
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
self.assertIn("wireshark: 4.2.6 -> 4.2.7", result.output)
|
self.assertIn("wireshark: 4.2.6 -> 4.2.7", result.output)
|
||||||
|
|
||||||
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
||||||
def test_pr_single_json(self, mock_get):
|
def test_pr_single_json(self, mock_get):
|
||||||
result = runner.invoke(app, ["pr", "--format", "json", "345583"])
|
result = runner.invoke(
|
||||||
|
app,
|
||||||
|
[
|
||||||
|
"pr",
|
||||||
|
"--format",
|
||||||
|
"json",
|
||||||
|
"--branches",
|
||||||
|
"nixos-unstable-small",
|
||||||
|
"--branches",
|
||||||
|
"nixos-unstable",
|
||||||
|
"--branches",
|
||||||
|
"nixos-24.11",
|
||||||
|
"345583",
|
||||||
|
],
|
||||||
|
)
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
expected = {
|
expected = {
|
||||||
"title": "wireshark: 4.2.6 -> 4.2.7",
|
"title": "wireshark: 4.2.6 -> 4.2.7",
|
||||||
@ -50,34 +78,3 @@ class TestCli(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
output = json.loads(result.output)
|
output = json.loads(result.output)
|
||||||
self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
|
||||||
def test_pr_multiple(self, mock_get):
|
|
||||||
result = runner.invoke(app, ["pr", "--format", "json", "345583", "345769"])
|
|
||||||
self.assertEqual(result.exit_code, 0)
|
|
||||||
expected = [
|
|
||||||
{
|
|
||||||
"title": "wireshark: 4.2.6 -> 4.2.7",
|
|
||||||
"merged": True,
|
|
||||||
"branches": {
|
|
||||||
"master": True,
|
|
||||||
"nixos-unstable-small": True,
|
|
||||||
"nixos-unstable": True,
|
|
||||||
"nixos-24.11": False,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Firefox: 130.0.1 -> 131.0; 128.2.0esr -> 128.3.0esr; 115.15.0esr -> 115.16.0esr",
|
|
||||||
"merged": True,
|
|
||||||
"branches": {
|
|
||||||
"nixos-unstable-small": False,
|
|
||||||
"nixos-unstable": False,
|
|
||||||
"nixos-24.11 (#346022)": True,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
output = []
|
|
||||||
for line in result.output.split("\n"):
|
|
||||||
if len(line) > 0:
|
|
||||||
output.append(json.loads(line))
|
|
||||||
self.assertEqual(output, expected)
|
|
||||||
|
@ -17,15 +17,6 @@ class TestPRMergeStatus(unittest.TestCase):
|
|||||||
self.assertTrue(res.branches["nixos-unstable"])
|
self.assertTrue(res.branches["nixos-unstable"])
|
||||||
self.assertFalse(res.branches["nixos-24.05"])
|
self.assertFalse(res.branches["nixos-24.05"])
|
||||||
|
|
||||||
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
|
||||||
def test_pr_merge_status_backport_345769(self, mock_get):
|
|
||||||
pr = 345769
|
|
||||||
branches = ["nixos-24.11"]
|
|
||||||
|
|
||||||
res = pr_merge_status(pr, branches, check_backport=True)
|
|
||||||
self.assertTrue(res.merged)
|
|
||||||
self.assertTrue(res.branches["nixos-24.11 (#346022)"])
|
|
||||||
|
|
||||||
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
||||||
def test_pr_merge_status_title_345769(self, mock_get):
|
def test_pr_merge_status_title_345769(self, mock_get):
|
||||||
pr = 345769
|
pr = 345769
|
||||||
|
Loading…
x
Reference in New Issue
Block a user