Move resolving git reference to config validation

Instead of multiple places handling the same thing duplicating the
logic, it's better to do it once upfront. This allows easy caching of
the results.

Additional advantage of this approach is that the config dump will
include resolved URLs. The original reference will still be available in
the copy of the original config.

JIRA: COMPOSE-3065
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-11-21 10:56:22 +01:00
parent 444af0396e
commit ca7d6256e5
14 changed files with 177 additions and 268 deletions

View file

@ -372,7 +372,8 @@ class OstreeInstallerConfigTestCase(ConfigTestCase):
class LiveMediaConfigTestCase(ConfigTestCase):
def test_global_config_validation(self):
@mock.patch("pungi.util.resolve_git_url")
def test_global_config_validation(self, resolve_git_url):
cfg = load_config(
PKGSET_REPOS,
live_media_ksurl='git://example.com/repo.git#HEAD',
@ -381,7 +382,10 @@ class LiveMediaConfigTestCase(ConfigTestCase):
live_media_version='Rawhide',
)
resolve_git_url.side_effect = lambda x: x.replace("HEAD", "CAFE")
self.assertValidation(cfg)
self.assertEqual(cfg["live_media_ksurl"], "git://example.com/repo.git#CAFE")
def test_global_config_null_release(self):
cfg = load_config(