mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 15:30:28 +03:00
download_repo_index_v2() for verified downloading of index-v2
This commit is contained in:
parent
a557764b4d
commit
f3e49f4bcb
4 changed files with 200 additions and 11 deletions
|
|
@ -67,6 +67,24 @@ class ApiTest(unittest.TestCase):
|
|||
)
|
||||
self.assertEqual(index_url, etag_set_to_url)
|
||||
|
||||
@mock.patch('fdroidserver.net.http_get')
|
||||
def test_download_repo_index_v2_url_parsing(self, mock_http_get):
|
||||
"""Test whether it is trying to download the right file
|
||||
|
||||
This passes the URL back via the etag return value just as a
|
||||
hack to check which URL was actually attempted.
|
||||
|
||||
"""
|
||||
mock_http_get.side_effect = lambda url, etag, timeout: (None, url)
|
||||
repo_url = 'https://example.org/fdroid/repo'
|
||||
entry_url = 'https://example.org/fdroid/repo/entry.jar'
|
||||
index_url = 'https://example.org/fdroid/repo/index-v2.json'
|
||||
for url in (repo_url, entry_url, index_url):
|
||||
_ignored, etag_set_to_url = fdroidserver.download_repo_index_v2(
|
||||
url, verify_fingerprint=False
|
||||
)
|
||||
self.assertEqual(entry_url, etag_set_to_url)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
newSuite = unittest.TestSuite()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue