summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/testcases/modules/ssh_keys_provided.py
blob: 544649da62ff4a59666b22c17fa002f9d0ca0ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# This file is part of cloud-init. See LICENSE file for license information.

"""cloud-init Integration Test Verify Script."""
from tests.cloud_tests.testcases import base


class TestSshKeysProvided(base.CloudTestCase):
    """Test ssh keys module."""

    def test_ubuntu_authorized_keys(self):
        """Test passed in key is not in list for ubuntu."""
        out = self.get_data_file('auth_keys_ubuntu')
        self.assertEqual('', out)

    def test_root_authorized_keys(self):
        """Test passed in key is in authorized list for root."""
        out = self.get_data_file('auth_keys_root')
        self.assertIn('lzrkPqONphoZx0LDV86w7RUz1ksDzAdcm0tvmNRFMN1a0frDs50'
                      '6oA3aWK0oDk4Nmvk8sXGTYYw3iQSkOvDUUlIsqdaO+w==', out)

    def test_dsa_public(self):
        """Test dsa public key passed in."""
        out = self.get_data_file('dsa_public')
        self.assertIn('AAAAB3NzaC1kc3MAAACBAPkWy1zbchVIN7qTgM0/yyY8q4RZS8c'
                      'NM4ZpeuE5UB/Nnr6OSU/nmbO8LuM', out)

    def test_dsa_private(self):
        """Test dsa private key passed in."""
        out = self.get_data_file('dsa_private')
        self.assertIn('MIIBuwIBAAKBgQD5Fstc23IVSDe6k4DNP8smPKuEWUvHDTOGaXr'
                      'hOVAfzZ6+jklP', out)

    def test_rsa_public(self):
        """Test rsa public key passed in."""
        out = self.get_data_file('rsa_public')
        self.assertIn('AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/Ho+o3eJISydO2JvIgT'
                      'LnZOtrxPl+fSvJfKDjoOLY0HB2eOjy2s2/2N6d9X9SGZ4', out)

    def test_rsa_private(self):
        """Test rsa public key passed in."""
        out = self.get_data_file('rsa_private')
        self.assertIn('4DOkqNiUGl80Zp1RgZNohHUXlJMtAbrIlAVEk+mTmg7vjfyp2un'
                      'RQvLZpMRdywBm', out)

    def test_ecdsa_public(self):
        """Test ecdsa public key passed in."""
        out = self.get_data_file('ecdsa_public')
        self.assertIn('AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAAB'
                      'BBFsS5Tvky/IC/dXhE/afxxU', out)

    def test_ecdsa_private(self):
        """Test ecdsa public key passed in."""
        out = self.get_data_file('ecdsa_private')
        self.assertIn('AwEHoUQDQgAEWxLlO+TL8gL91eET9p/HFQbqR1A691AkJgZk3jY'
                      '5mpZqxgX4vcgb', out)

    def test_ed25519_public(self):
        """Test ed25519 public key passed in."""
        out = self.get_data_file('ed25519_public')
        self.assertIn('AAAAC3NzaC1lZDI1NTE5AAAAINudAZSu4vjZpVWzId5pXmZg1M6'
                      'G15dqjQ2XkNVOEnb5', out)

    def test_ed25519_private(self):
        """Test ed25519 public key passed in."""
        out = self.get_data_file('ed25519_private')
        self.assertIn('XAAAAAtzc2gtZWQyNTUxOQAAACDbnQGUruL42aVVsyHeaV5mYNT'
                      'OhteXao0Nl5DVThJ2+Q', out)

# vi: ts=4 expandtab