Debian Codegraph @

test/units/plugins/connection/test_local.py

raw
1 #
2 # (c) 2020 Red Hat Inc.
3 #
4 # This file is part of Ansible
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18
19 from __future__ import annotations
20
21 from io import StringIO
22
23 import unittest
24 from ansible.plugins.connection import local
25 from ansible.playbook.play_context import PlayContext
26
27
28 class TestLocalConnectionClass(unittest.TestCase):
29
30 def test_local_connection_module(self):
31 play_context = PlayContext()
32 play_context.prompt = (
33 '[sudo via ansible, key=ouzmdnewuhucvuaabtjmweasarviygqq] password: '
34 )
35 in_stream = StringIO()
36
37 self.assertIsInstance(local.Connection(play_context, in_stream), local.Connection)