mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
index: use 'fake.url' as test domain when no networking is used
This commit is contained in:
parent
5e75b03814
commit
98decf8cfa
1 changed files with 17 additions and 17 deletions
|
|
@ -181,10 +181,10 @@ class IndexTest(unittest.TestCase):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mock_http_get.side_effect = lambda url, etag, timeout: (None, url)
|
mock_http_get.side_effect = lambda url, etag, timeout: (None, url)
|
||||||
repo_url = 'https://example.org/fdroid/repo'
|
repo_url = 'https://fake.url/fdroid/repo'
|
||||||
index_url = 'https://example.org/fdroid/repo/index-v1.jar'
|
index_url = 'https://fake.url/fdroid/repo/index-v1.jar'
|
||||||
fingerprint_url = 'https://example.org/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
fingerprint_url = 'https://fake.url/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
||||||
slash_url = 'https://example.org/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
slash_url = 'https://fake.url/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
||||||
for url in (repo_url, index_url, fingerprint_url, slash_url):
|
for url in (repo_url, index_url, fingerprint_url, slash_url):
|
||||||
_ignored, etag_set_to_url = fdroidserver.index.download_repo_index(url, verify_fingerprint=False)
|
_ignored, etag_set_to_url = fdroidserver.index.download_repo_index(url, verify_fingerprint=False)
|
||||||
self.assertEqual(index_url, etag_set_to_url)
|
self.assertEqual(index_url, etag_set_to_url)
|
||||||
|
|
@ -198,11 +198,11 @@ class IndexTest(unittest.TestCase):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mock_http_get.side_effect = lambda url, etag, timeout: (None, url)
|
mock_http_get.side_effect = lambda url, etag, timeout: (None, url)
|
||||||
repo_url = 'https://example.org/fdroid/repo'
|
repo_url = 'https://fake.url/fdroid/repo'
|
||||||
entry_url = 'https://example.org/fdroid/repo/entry.jar'
|
entry_url = 'https://fake.url/fdroid/repo/entry.jar'
|
||||||
index_url = 'https://example.org/fdroid/repo/index-v2.json'
|
index_url = 'https://fake.url/fdroid/repo/index-v2.json'
|
||||||
fingerprint_url = 'https://example.org/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
fingerprint_url = 'https://fake.url/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
||||||
slash_url = 'https://example.org/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
slash_url = 'https://fake.url/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
||||||
for url in (repo_url, entry_url, index_url, fingerprint_url, slash_url):
|
for url in (repo_url, entry_url, index_url, fingerprint_url, slash_url):
|
||||||
_ignored, etag_set_to_url = fdroidserver.index.download_repo_index_v2(
|
_ignored, etag_set_to_url = fdroidserver.index.download_repo_index_v2(
|
||||||
url, verify_fingerprint=False
|
url, verify_fingerprint=False
|
||||||
|
|
@ -222,11 +222,11 @@ class IndexTest(unittest.TestCase):
|
||||||
shutil.copy(os.path.join(self.basedir, 'repo', 'entry.json'), 'repo')
|
shutil.copy(os.path.join(self.basedir, 'repo', 'entry.json'), 'repo')
|
||||||
shutil.copy(os.path.join(self.basedir, 'repo', 'index-v2.json'), 'repo')
|
shutil.copy(os.path.join(self.basedir, 'repo', 'index-v2.json'), 'repo')
|
||||||
fdroidserver.signindex.sign_index('repo', 'entry.json')
|
fdroidserver.signindex.sign_index('repo', 'entry.json')
|
||||||
repo_url = 'https://example.org/fdroid/repo'
|
repo_url = 'https://fake.url/fdroid/repo'
|
||||||
entry_url = 'https://example.org/fdroid/repo/entry.jar'
|
entry_url = 'https://fake.url/fdroid/repo/entry.jar'
|
||||||
index_url = 'https://example.org/fdroid/repo/index-v2.json'
|
index_url = 'https://fake.url/fdroid/repo/index-v2.json'
|
||||||
fingerprint_url = 'https://example.org/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
fingerprint_url = 'https://fake.url/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
||||||
slash_url = 'https://example.org/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
slash_url = 'https://fake.url/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
||||||
for url in (repo_url, entry_url, index_url, fingerprint_url, slash_url):
|
for url in (repo_url, entry_url, index_url, fingerprint_url, slash_url):
|
||||||
data, _ignored = fdroidserver.index.download_repo_index_v2(
|
data, _ignored = fdroidserver.index.download_repo_index_v2(
|
||||||
url, verify_fingerprint=False
|
url, verify_fingerprint=False
|
||||||
|
|
@ -247,7 +247,7 @@ class IndexTest(unittest.TestCase):
|
||||||
shutil.copy(os.path.join(self.basedir, 'repo', 'index-v2.json'), 'repo')
|
shutil.copy(os.path.join(self.basedir, 'repo', 'index-v2.json'), 'repo')
|
||||||
fdroidserver.signindex.sign_index('repo', 'entry.json')
|
fdroidserver.signindex.sign_index('repo', 'entry.json')
|
||||||
bad_fp = '0123456789001234567890012345678900123456789001234567890012345678'
|
bad_fp = '0123456789001234567890012345678900123456789001234567890012345678'
|
||||||
bad_fp_url = 'https://example.org/fdroid/repo?fingerprint=' + bad_fp
|
bad_fp_url = 'https://fake.url/fdroid/repo?fingerprint=' + bad_fp
|
||||||
with self.assertRaises(fdroidserver.exception.VerificationException):
|
with self.assertRaises(fdroidserver.exception.VerificationException):
|
||||||
data, _ignored = fdroidserver.index.download_repo_index_v2(bad_fp_url)
|
data, _ignored = fdroidserver.index.download_repo_index_v2(bad_fp_url)
|
||||||
|
|
||||||
|
|
@ -256,7 +256,7 @@ class IndexTest(unittest.TestCase):
|
||||||
def http_get_def(url, etag, timeout): # pylint: disable=unused-argument
|
def http_get_def(url, etag, timeout): # pylint: disable=unused-argument
|
||||||
return (b'not the entry.jar file contents', 'fakeetag')
|
return (b'not the entry.jar file contents', 'fakeetag')
|
||||||
mock_http_get.side_effect = http_get_def
|
mock_http_get.side_effect = http_get_def
|
||||||
url = 'https://example.org/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
url = 'https://fake.url/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
||||||
with self.assertRaises(fdroidserver.exception.VerificationException):
|
with self.assertRaises(fdroidserver.exception.VerificationException):
|
||||||
data, _ignored = fdroidserver.index.download_repo_index_v2(url)
|
data, _ignored = fdroidserver.index.download_repo_index_v2(url)
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ class IndexTest(unittest.TestCase):
|
||||||
shutil.copy(os.path.join(self.basedir, 'repo', 'entry.json'), 'repo')
|
shutil.copy(os.path.join(self.basedir, 'repo', 'entry.json'), 'repo')
|
||||||
shutil.copy(os.path.join(self.basedir, 'repo', 'index-v2.json'), 'repo')
|
shutil.copy(os.path.join(self.basedir, 'repo', 'index-v2.json'), 'repo')
|
||||||
fdroidserver.signindex.sign_index('repo', 'entry.json')
|
fdroidserver.signindex.sign_index('repo', 'entry.json')
|
||||||
url = 'https://example.org/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
url = 'https://fake.url/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
||||||
with self.assertRaises(fdroidserver.exception.VerificationException):
|
with self.assertRaises(fdroidserver.exception.VerificationException):
|
||||||
data, _ignored = fdroidserver.index.download_repo_index_v2(url)
|
data, _ignored = fdroidserver.index.download_repo_index_v2(url)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue