summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-02-16 15:08:13 +0100
committerChristian Poessinger <christian@poessinger.com>2019-02-16 15:08:13 +0100
commit18a76f695e44079e638ffc86799e6cb952810316 (patch)
tree67d92d5b9a19b2c2e8f7e2f53ba83ba85f29e69e /src/tests
parent6c430bd9e229ff6746a3d2470943aadf5fabfc1e (diff)
downloadvyos-1x-18a76f695e44079e638ffc86799e6cb952810316.tar.gz
vyos-1x-18a76f695e44079e638ffc86799e6cb952810316.zip
Tests: fix hostname tests
Commit 3d3eccd687 ("T1174: migrate local hostname/DNS handling to vyos-1x") changed a lot of the internal data handling for setting the systems host and domain name information.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_host_name.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tests/test_host_name.py b/src/tests/test_host_name.py
index 8c5210d5f..865a69ee6 100644
--- a/src/tests/test_host_name.py
+++ b/src/tests/test_host_name.py
@@ -37,19 +37,19 @@ class TestHostName(TestCase):
{'name': 'empty_hostname_and_domain',
'host-name': '',
'domain-name': '',
- 'expected': {"hostname": 'vyos', "domain": '', "fqdn": 'vyos'}},
+ 'expected': {"hostname": 'vyos', "domain_name": '', "domain_search": ''}},
{'name': 'empty_hostname',
'host-name': '',
'domain-name': 'localdomain',
- 'expected': {"hostname": 'vyos', "domain": 'localdomain', "fqdn": 'vyos.localdomain'}},
+ 'expected': {"hostname": 'vyos', "domain_name": 'localdomain', "domain_search": ''}},
{'name': 'has_hostname',
'host-name': 'router',
'domain-name': '',
- 'expected': {"hostname": 'router', "domain": '', "fqdn": 'router'}},
+ 'expected': {"hostname": 'router', "domain_name": '', "domain_search": ''}},
{'name': 'has_hostname_and_domain',
'host-name': 'router',
'domain-name': 'localdomain',
- 'expected': {"hostname": 'router', "domain": 'localdomain', "fqdn": 'router.localdomain'}},
+ 'expected': {"hostname": 'router', "domain_name": 'localdomain', "domain_search": ''}},
]
for t in tests:
def mocked_return_value(path, default=None):
@@ -64,13 +64,13 @@ class TestHostName(TestCase):
def test_verify(self):
tests = [
{'name': 'valid_hostname',
- 'config': {"hostname": 'vyos', "domain": 'localdomain', "fqdn": 'vyos.localdomain'},
+ 'config': {"hostname": 'vyos', "domain_name": 'localdomain', "domain_search": ''},
'expected': None},
{'name': 'invalid_hostname',
- 'config': {"hostname": 'vyos..', "domain": '', "fqdn": ''},
+ 'config': {"hostname": 'vyos..', "domain_name": '', "domain_search": ''},
'expected': ConfigError},
{'name': 'invalid_hostname_length',
- 'config': {"hostname": 'a'*64, "domain": '', "fqdn": ''},
+ 'config': {"hostname": 'a'*64, "domain_name": '', "domain_search": ''},
'expected': ConfigError}
]
for t in tests:
@@ -85,11 +85,11 @@ class TestHostName(TestCase):
tests = [
{'name': 'has_old_entry',
'has_old_entry': True,
- 'config': {"hostname": 'router', "domain": 'localdomain', "fqdn": 'router.localdomain'},
+ 'config': {"hostname": 'router', "domain_name": 'localdomain', "domain_search": '', "no_dhcp_ns": False, "nameserver": []},
'expected': ['127.0.1.1', 'router.localdomain']},
{'name': 'no_old_entry',
'has_old_entry': False,
- 'config': {"hostname": 'router', "domain": 'localdomain', "fqdn": 'router.localdomain'},
+ 'config': {"hostname": 'router', "domain_name": 'localdomain', "domain_search": 'vyos.io', "no_dhcp_ns": False, "nameserver": []},
'expected': ['127.0.1.1', 'router.localdomain']},
]
for t in tests:
@@ -115,7 +115,7 @@ class TestHostName(TestCase):
def test_apply(self):
tests = [
{'name': 'valid_hostname',
- 'config': {"hostname": 'router', "domain": 'localdomain', "fqdn": 'router.localdomain'},
+ 'config': {"hostname": 'router', "domain_name": 'localdomain'},
'expected': [mock.call('hostnamectl set-hostname --static router.localdomain'),
mock.call('systemctl restart rsyslog.service')]}
]