diff options
Diffstat (limited to 'tests/unittests/config/test_cc_ssh.py')
-rw-r--r-- | tests/unittests/config/test_cc_ssh.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/unittests/config/test_cc_ssh.py b/tests/unittests/config/test_cc_ssh.py index 8f2ca8bf..66368d0f 100644 --- a/tests/unittests/config/test_cc_ssh.py +++ b/tests/unittests/config/test_cc_ssh.py @@ -311,6 +311,7 @@ class TestHandleSsh: cfg = {"ssh_keys": {}} expected_calls = [] + cert_content = "" for key_type in cc_ssh.GENERATE_KEY_NAMES: private_name = "{}_private".format(key_type) public_name = "{}_public".format(key_type) @@ -330,26 +331,32 @@ class TestHandleSsh: mock.call( "/etc/ssh/ssh_host_{}_key".format(key_type), private_value, - 384, + 0o600, ), mock.call( "/etc/ssh/ssh_host_{}_key.pub".format(key_type), public_value, - 384, + 0o644, ), mock.call( "/etc/ssh/ssh_host_{}_key-cert.pub".format(key_type), cert_value, - 384, - ), - mock.call( - sshd_conf_fname, - "HostCertificate /etc/ssh/ssh_host_{}_key-cert.pub" - "\n".format(key_type), - preserve_mode=True, + 0o644, ), ] ) + cert_content += ( + f"HostCertificate /etc/ssh/ssh_host_{key_type}_key-cert.pub\n" + ) + + expected_calls.append( + mock.call( + sshd_conf_fname, + cert_content, + omode="ab", + preserve_mode=True, + ) + ) # Run the handler. m_nug.return_value = ([], {}) |