示例#1
0
    def test_cloud_get_user_data(self, mock_generate_ssh_key):
        mock_generate_ssh_key.return_value = b'testkey12345'

        provider = IpaCloud(*args, **self.kwargs)

        result = provider._get_user_data()

        assert result == \
            '#!/bin/bash\n' \
            'echo testkey12345 >> /home/ec2-user/.ssh/authorized_keys\n'
示例#2
0
    def test_cloud_get_user_data(self, mock_get_ssh_key):
        mock_get_ssh_key.return_value = b'testkey12345'

        provider = IpaCloud(**self.kwargs)

        result = provider._get_user_data()

        assert result == \
            "#cloud-config\n" \
            "disable_root: true\n\n" \
            "runcmd:\n" \
            " - [ sh, -c, 'echo testkey12345 >> " \
            "/home/ec2-user/.ssh/authorized_keys' ]\n"