diff options
author | Paul Goins <paul.goins@canonical.com> | 2021-05-18 17:02:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-18 12:02:51 -0500 |
commit | 1793b8b70ca2e3587c271155033ef943207136ae (patch) | |
tree | 119b896a67d8fc0be9bd1c505690c8da50cd3e13 /tests | |
parent | 21a0b12052691d6634d0848dfa353c12939945e9 (diff) | |
download | vyos-cloud-init-1793b8b70ca2e3587c271155033ef943207136ae.tar.gz vyos-cloud-init-1793b8b70ca2e3587c271155033ef943207136ae.zip |
Added support for importing keys via primary/security mirror clauses (#882)
Presently, mirror keys cannot be associated with primary/security
mirrors. Unfortunately, this prevents use of Landscape-managed
package mirrors as the mirror key for the Landscape-hosted repository
cannot be provided.
This patch allows the same key-related fields usable on "sources"
entries to be used on the "primary" and "security" entries as well.
LP: #1925395
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/test_handler/test_handler_apt_source_v3.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_source_v3.py b/tests/unittests/test_handler/test_handler_apt_source_v3.py index ac847238..abb0a9b6 100644 --- a/tests/unittests/test_handler/test_handler_apt_source_v3.py +++ b/tests/unittests/test_handler/test_handler_apt_source_v3.py @@ -1009,6 +1009,29 @@ deb http://ubuntu.com/ubuntu/ xenial-proposed main""") self.assertEqual(mirrors['SECURITY'], smir) + def test_apt_v3_add_mirror_keys(self): + """test_apt_v3_add_mirror_keys - Test adding key for mirrors""" + arch = 'amd64' + cfg = { + 'primary': [ + {'arches': [arch], + 'uri': 'http://test.ubuntu.com/', + 'key': 'fakekey_primary'}], + 'security': [ + {'arches': [arch], + 'uri': 'http://testsec.ubuntu.com/', + 'key': 'fakekey_security'}] + } + + with mock.patch.object(cc_apt_configure, + 'add_apt_key_raw') as mockadd: + cc_apt_configure.add_mirror_keys(cfg, TARGET) + calls = [ + mock.call('fakekey_primary', TARGET), + mock.call('fakekey_security', TARGET), + ] + mockadd.assert_has_calls(calls, any_order=True) + class TestDebconfSelections(TestCase): |