From 79917a4817caabe32bce8b41181ee64013c782a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Roz=C3=A9?= Date: Mon, 8 Apr 2024 10:37:32 +0200 Subject: [PATCH] tests: insteadOf unittest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rewrite fake url to correct url with insteadOf option to make sure it's effective Signed-off-by: David Rozé --- repo_resource/test_check.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/repo_resource/test_check.py b/repo_resource/test_check.py index 706c6fd..a8e1630 100644 --- a/repo_resource/test_check.py +++ b/repo_resource/test_check.py @@ -32,6 +32,18 @@ def setUp(self): 'name': 'aosp_device_fixed.xml' } } + self.demo_manifests_to_rewrite_source = { + 'source': { + 'url': + 'https://unreachable-github.com/makohoek/demo-manifests.git', + 'revision': 'main', + 'name': 'aosp_device_fixed.xml', + 'insteadOf': { + 'https://github.com': + 'https://unreachable-github.com' + }, + }, + } self.demo_manifests_source_norev = { 'source': { 'url': 'https://github.com/makohoek/demo-manifests.git', @@ -92,6 +104,11 @@ def test_unreachable_manifest(self): with self.assertRaises(repo.error.GitError): check.check(instream) + def test_rewrite_manifest(self): + rewrite_url_data = self.demo_manifests_to_rewrite_source + instream = StringIO(json.dumps(rewrite_url_data)) + check.check(instream) + def test_unknown_revision(self): unknown_revision_data = self.aosp_platform_source unknown_revision_data['source']['revision'] = 'unknown'