mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-16 06:44:43 -06:00
feat: fill the large file issue form
validate_pr linked the bare missing-bios form for a file too large for git and then said to put it in the pull request and under bios/. The link now carries filename, sha1, md5 and size, and the pull request advice is left out for such a file.
This commit is contained in:
1 parent
f1f2254be8
commit
81acb00536
2 files changed
+52
-6
No files matched your search
@@ -115,6 +115,30 @@ class OversizedFileAdvice(unittest.TestCase):
|
||||
self.assertIn("open an issue", message)
|
||||
self.assertIn(validate_pr.LARGE_FILE_ISSUE_URL, message)
|
||||
|
||||
def test_the_issue_form_is_filled_and_nothing_points_to_the_pr(self):
|
||||
"""The link opened an empty form, and the same report said to put the
|
||||
file in the pull request and under bios/."""
|
||||
import urllib.parse # noqa: PLC0415
|
||||
|
||||
path = self.tmp / "big.bin"
|
||||
path.write_bytes(b"x" * 8)
|
||||
validate_pr.MAX_FILE_SIZE = 4
|
||||
result = validate_pr.validate_file(
|
||||
"big.bin", None, {"sha1": set(), "md5": set(), "names": set()},
|
||||
)
|
||||
message = next(m for s, m in result.checks if s == "FAIL" and "too large" in m)
|
||||
url = message.split("(", 2)[2].split(")", 1)[0]
|
||||
query = urllib.parse.parse_qs(urllib.parse.urlsplit(url).query)
|
||||
template = (REPO_ROOT / ".github" / "ISSUE_TEMPLATE" / "missing-bios.yml").read_text()
|
||||
for field, value in (("filename", "big.bin"), ("sha1", result.sha1),
|
||||
("md5", result.md5), ("size", "8")):
|
||||
with self.subTest(field=field):
|
||||
self.assertIn(f"id: {field}\n", template)
|
||||
self.assertEqual(query[field], [value])
|
||||
others = " ".join(m for _s, m in result.checks)
|
||||
self.assertNotIn("pull request which", others)
|
||||
self.assertNotIn("not under bios/", others)
|
||||
|
||||
def test_the_linked_issue_template_exists(self):
|
||||
template = validate_pr.LARGE_FILE_ISSUE_URL.rsplit("template=", 1)[1]
|
||||
self.assertTrue(
|
||||
|
||||
Reference in new issue
Block a user