From 9ac84f533b9dfd80dbf00708ac1f58d260bfdfa7 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 11 Jul 2020 20:22:13 +0200 Subject: snmp: test that encrypted-password is properly inserted into CLI --- scripts/cli/test_service_snmp.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts/cli/test_service_snmp.py') diff --git a/scripts/cli/test_service_snmp.py b/scripts/cli/test_service_snmp.py index 983eadf4c..f4f20a3cb 100755 --- a/scripts/cli/test_service_snmp.py +++ b/scripts/cli/test_service_snmp.py @@ -92,7 +92,6 @@ class TestSNMPService(unittest.TestCase): self.session.set(base_path + ['v3', 'view', 'default', 'oid', '1']) self.session.set(base_path + ['v3', 'group', 'default', 'view', 'default']) - self.session.commit() # create user self.session.set(base_path + ['v3', 'user', 'vyos', 'auth', 'plaintext-password', 'vyos12345678']) @@ -101,6 +100,16 @@ class TestSNMPService(unittest.TestCase): self.session.set(base_path + ['v3', 'user', 'vyos', 'privacy', 'type', 'aes']) self.session.set(base_path + ['v3', 'user', 'vyos', 'group', 'default']) + self.session.commit() + + # commit will alter the CLI values - check if they have been updated: + hashed_password = '4e52fe55fd011c9c51ae2c65f4b78ca93dcafdfe' + tmp = self.session.show_config(base_path + ['v3', 'user', 'vyos', 'auth', 'encrypted-password']).split()[1] + self.assertEqual(tmp, hashed_password) + + tmp = self.session.show_config(base_path + ['v3', 'user', 'vyos', 'privacy', 'encrypted-password']).split()[1] + self.assertEqual(tmp, hashed_password) + # TODO: read in config file and check values # Check for running process -- cgit v1.2.3