summaryrefslogtreecommitdiff
path: root/tests/integration_tests/modules/test_ssh_import_id.py
blob: 45d37d6ca33ff1fe97a9f5e626981db1e10257f9 (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
"""Integration test for the ssh_import_id module.

This test specifies ssh keys to be imported by the ``ssh_import_id`` module
and then checks that if the ssh keys were successfully imported.

(This is ported from
``tests/cloud_tests/testcases/modules/ssh_import_id.yaml``.)"""

import pytest


USER_DATA = """\
#cloud-config
ssh_import_id:
  - gh:powersj
  - lp:smoser
"""


@pytest.mark.ci
class TestSshImportId:

    @pytest.mark.user_data(USER_DATA)
    def test_ssh_import_id(self, client):
        ssh_output = client.read_from_file(
            "/home/ubuntu/.ssh/authorized_keys")

        assert '# ssh-import-id gh:powersj' in ssh_output
        assert '# ssh-import-id lp:smoser' in ssh_output