Exemple #1
0
    def test_execute_git_command_auto_sets_strict_host_option_correctly(self, strict_host_check_setting):
        Configuration['git_strict_host_key_checking'] = strict_host_check_setting
        popen_mock = self._patch_popen()

        git = Git(url='http://some-user-url.com/repo-path/repo-name')
        git._execute_git_command_in_repo_and_raise_on_failure('fakecmd')

        if strict_host_check_setting:
            expected_ssh_arg = '-o StrictHostKeyChecking=yes'
        else:
            expected_ssh_arg = '-o StrictHostKeyChecking=no'

        expected_call = call(AnyStringMatching(expected_ssh_arg),
                             start_new_session=ANY, stdout=ANY, stderr=ANY, cwd=ANY, shell=ANY)
        self.assertIn(expected_call, popen_mock.call_args_list, 'Executed git command should include the correct '
                                                                'option for StrictHostKeyChecking.')
Exemple #2
0
    def test_execute_git_command_auto_sets_strict_host_option_correctly(self, strict_host_check_setting):
        Configuration['git_strict_host_key_checking'] = strict_host_check_setting
        popen_mock = self._patch_popen()

        git = Git(url='http://some-user-url.com/repo-path/repo-name')
        git._execute_git_command_in_repo_and_raise_on_failure('fakecmd')

        if strict_host_check_setting:
            expected_ssh_arg = '-o StrictHostKeyChecking=yes'
        else:
            expected_ssh_arg = '-o StrictHostKeyChecking=no'

        expected_call = call(AnyStringMatching(expected_ssh_arg),
                             start_new_session=ANY, stdout=ANY, stderr=ANY, cwd=ANY, shell=ANY)
        self.assertIn(expected_call, popen_mock.call_args_list, 'Executed git command should include the correct '
                                                                'option for StrictHostKeyChecking.')