コード例 #1
0
 def test_plugins_connection_file_transport_command(self, boto_client,
                                                    s_check_output):
     pc = PlayContext()
     new_stdin = StringIO()
     conn = connection_loader.get('community.aws.aws_ssm', pc, new_stdin)
     conn.get_option = MagicMock()
     conn.get_option.side_effect = ['1', '2', '3', '4', '5']
     conn._get_url = MagicMock()
     conn._get_url.side_effect = ['url1', 'url2']
     boto3 = MagicMock()
     boto3.client('s3').return_value = MagicMock()
     conn.get_option.return_value = 1
     ssm_action = 'get'
     get_command = MagicMock()
     put_command = MagicMock()
     conn.exec_command = MagicMock()
     conn.exec_command.return_value = (put_command, None, False)
     conn.download_fileobj = MagicMock()
     (returncode, stdout, stderr) = conn.exec_command(put_command,
                                                      in_data=None,
                                                      sudoable=False)
     returncode = 0
     (returncode, stdout, stderr) = conn.exec_command(get_command,
                                                      in_data=None,
                                                      sudoable=False)
コード例 #2
0
ファイル: test_aws_ssm.py プロジェクト: zeten30/community.aws
 def test_plugins_connection_aws_ssm_get_url(self, boto):
     pc = PlayContext()
     new_stdin = StringIO()
     conn = connection_loader.get('community.aws.aws_ssm', pc, new_stdin)
     boto3 = MagicMock()
     boto3.client('s3').return_value = MagicMock()
     boto3.generate_presigned_url.return_value = MagicMock()
     return (boto3.generate_presigned_url.return_value)
コード例 #3
0
ファイル: test_aws_ssm.py プロジェクト: zeten30/community.aws
 def test_plugins_connection_aws_ssm_start_session(self, boto_client, s_poll, s_popen, mock_ospe):
     pc = PlayContext()
     new_stdin = StringIO()
     conn = connection_loader.get('community.aws.aws_ssm', pc, new_stdin)
     conn.get_option = MagicMock()
     conn.get_option.side_effect = ['i1234', 'executable', 'abcd', 'i1234']
     conn.host = 'abc'
     mock_ospe.return_value = True
     boto3 = MagicMock()
     boto3.client('ssm').return_value = MagicMock()
     conn.start_session = MagicMock()
     conn._session_id = MagicMock()
     conn._session_id.return_value = 's1'
     s_popen.return_value.stdin.write = MagicMock()
     s_poll.return_value = MagicMock()
     s_poll.return_value.register = MagicMock()
     s_popen.return_value.poll = MagicMock()
     s_popen.return_value.poll.return_value = None
     conn._stdin_readline = MagicMock()
     conn._stdin_readline.return_value = 'abc123'
     conn.SESSION_START = 'abc'
     conn.start_session()