summaryrefslogtreecommitdiff
path: root/cloudinit/distros/tests/test_init.py
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-03-31 17:04:17 -0400
committerGitHub <noreply@github.com>2020-03-31 17:04:17 -0400
commit1bbc4908ff7a2be19483811b3b6fee6ebc916235 (patch)
treeb357588131b799793c53a61ce8381acd2737ee56 /cloudinit/distros/tests/test_init.py
parentf51e3d0e23b2873f077d1b7b3ac6874b94b1a374 (diff)
downloadvyos-cloud-init-1bbc4908ff7a2be19483811b3b6fee6ebc916235.tar.gz
vyos-cloud-init-1bbc4908ff7a2be19483811b3b6fee6ebc916235.zip
distros: drop leading/trailing hyphens from mirror URL labels (#296)
* distros/tests/test_init: drop needless brackets/indentation * distros: drop leading/trailing hyphens from mirror URL labels
Diffstat (limited to 'cloudinit/distros/tests/test_init.py')
-rw-r--r--cloudinit/distros/tests/test_init.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/cloudinit/distros/tests/test_init.py b/cloudinit/distros/tests/test_init.py
index daa81ab8..40939133 100644
--- a/cloudinit/distros/tests/test_init.py
+++ b/cloudinit/distros/tests/test_init.py
@@ -109,15 +109,17 @@ class TestGetPackageMirrorInfo:
['http://%(region)s.in.hostname/should/be/filtered',
'http://but.not.in.the.path/%(region)s'],
['http://but.not.in.the.path/inv[lid']),
- ) + (
+ (None, '-some-region-',
+ ['http://-lead-ing.%(region)s.trail-ing-.example.com/ubuntu'],
+ ['http://lead-ing.some-region.trail-ing.example.com/ubuntu']),
+ ) + tuple(
# Dynamically generate a test case for each non-LDH
# (Letters/Digits/Hyphen) ASCII character, testing that it is
# substituted with a hyphen
- tuple(
- (None, 'fk{0}fake{0}1'.format(invalid_char),
- ['http://%(region)s/ubuntu'], ['http://fk-fake-1/ubuntu'])
- for invalid_char in INVALID_URL_CHARS))
- )
+ (None, 'fk{0}fake{0}1'.format(invalid_char),
+ ['http://%(region)s/ubuntu'], ['http://fk-fake-1/ubuntu'])
+ for invalid_char in INVALID_URL_CHARS
+ ))
def test_substitution(self, availability_zone, region, patterns, expected):
"""Test substitution works as expected."""
m_data_source = mock.Mock(