mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
fix: build github api headers with forge_headers
download.py read GITHUB_TOKEN only and missed the gh login token, the readme built its header by hand, and the large files listing cached one failed request as an empty release for the whole run.
This commit is contained in:
1 parent
6138d43dfb
commit
8bfa188960
5 files changed
+44
-27
No files matched your search
@@ -92,6 +92,10 @@ class LargeFileCacheTest(unittest.TestCase):
|
||||
_test_registry(self)
|
||||
self.dir = tempfile.mkdtemp()
|
||||
self._urlopen = largefiles.urllib.request.urlopen
|
||||
# No release digests: a replaced asset is told by its size.
|
||||
digests = mock.patch.object(largefiles, "_digests_cache", {})
|
||||
digests.start()
|
||||
self.addCleanup(digests.stop)
|
||||
|
||||
def tearDown(self):
|
||||
largefiles.urllib.request.urlopen = self._urlopen
|
||||
@@ -909,5 +913,27 @@ class AVerifiedPathKeepsItsBytes(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class AFailedReleaseListingIsAskedAgain(unittest.TestCase):
|
||||
"""One dropped connection on the release listing was kept as {} for the
|
||||
run, and every asset fell back to its Content-Length."""
|
||||
|
||||
def test_the_listing_is_read_again_after_a_failure(self):
|
||||
from core import upstream
|
||||
|
||||
release = {"assets": [{"name": "a.zip", "digest": "sha256:ABC"}]}
|
||||
answers = [upstream.UpstreamError("reset"), json.dumps(release).encode()]
|
||||
|
||||
def fetch_body(*_args, **_kwargs):
|
||||
answer = answers.pop(0)
|
||||
if isinstance(answer, Exception):
|
||||
raise answer
|
||||
return answer
|
||||
|
||||
with mock.patch.object(largefiles, "_digests_cache", None), \
|
||||
mock.patch.object(upstream, "fetch_body", fetch_body):
|
||||
self.assertEqual(largefiles._served_digests(), {})
|
||||
self.assertEqual(largefiles._served_digests(), {"a.zip": "abc"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user