diff options
| author | Nicolas Vandamme <n.vandamme@firis-system.lu> | 2025-09-01 17:24:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-01 17:24:26 +0200 |
| commit | a791cc3b7bb28081a6e79a988964f1fc51a47dae (patch) | |
| tree | ef5e734bf580f1abfd7d3d4ea30240d8d9fb1278 /src/tests/test_template.py | |
| parent | b9f60711392463af1892a30472fba6622a73390a (diff) | |
| parent | b1b4545cb7984cd3cdf42554ab2b28acd1ecb6cb (diff) | |
| download | vyos-1x-a791cc3b7bb28081a6e79a988964f1fc51a47dae.tar.gz vyos-1x-a791cc3b7bb28081a6e79a988964f1fc51a47dae.zip | |
Merge branch 'vyos:current' into current
Diffstat (limited to 'src/tests/test_template.py')
| -rw-r--r-- | src/tests/test_template.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/tests/test_template.py b/src/tests/test_template.py index 6377f6da5..e2548602d 100644 --- a/src/tests/test_template.py +++ b/src/tests/test_template.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020-2024 VyOS maintainers and contributors +# Copyright VyOS maintainers and contributors <maintainers@vyos.io> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -190,3 +190,21 @@ class TestVyOSTemplate(TestCase): for group_name, group_config in data['ike_group'].items(): ciphers = vyos.template.get_esp_ike_cipher(group_config) self.assertIn(IKEv2_DEFAULT, ','.join(ciphers)) + + def test_get_default_port(self): + from vyos.defaults import config_files + from vyos.defaults import internal_ports + + with self.assertRaises(RuntimeError): + vyos.template.get_default_config_file('UNKNOWN') + with self.assertRaises(RuntimeError): + vyos.template.get_default_port('UNKNOWN') + with self.assertRaises(RuntimeError): + vyos.template.nft_accept_invalid('UNKNOWN') + + self.assertEqual(vyos.template.get_default_config_file('sshd_user_ca'), + config_files['sshd_user_ca']) + self.assertEqual(vyos.template.get_default_port('certbot_haproxy'), + internal_ports['certbot_haproxy']) + self.assertEqual(vyos.template.nft_accept_invalid('arp'), + 'ct state invalid ether type arp counter accept') |
