File: test_ssh_import_id.py

package info (click to toggle)
cloud-init 20.4.1-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,920 kB
  • sloc: python: 77,120; sh: 4,003; makefile: 107; xml: 21
file content (29 lines) | stat: -rw-r--r-- 705 bytes parent folder | download
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