summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/testcases/examples/configure_instances_ssh_keys.py
blob: 691a316bfac8b7d09ce6a7731d4d2ca3b3cea2ed (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
# 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 TestSSHKeys(base.CloudTestCase):
    """Example cloud-config test."""

    def test_cert_count(self):
        """Test cert count."""
        out = self.get_data_file('cert_count')
        self.assertEqual(20, int(out))

    def test_dsa_public(self):
        """Test DSA key has ending."""
        out = self.get_data_file('dsa_public')
        self.assertIn('ZN4XnifuO5krqAybngIy66PMEoQ= smoser@localhost', out)

    def test_rsa_public(self):
        """Test RSA key has specific ending."""
        out = self.get_data_file('rsa_public')
        self.assertIn('PemAWthxHO18QJvWPocKJtlsDNi3 smoser@localhost', out)

    def test_auth_keys(self):
        """Test authorized keys has specific ending."""
        out = self.get_data_file('auth_keys')
        self.assertIn('QPOt5Q8zWd9qG7PBl9+eiH5qV7NZ mykey@host', out)
        self.assertIn('Hj29SCmXp5Kt5/82cD/VN3NtHw== smoser@brickies', out)

# vi: ts=4 expandtab