@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._install_cert')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_installer_param_override(self, _inst, _rec, mock_install, _):
    mock_lineage = mock.MagicMock(cert_path=test_util.temp_join('cert'), chain_path=test_util.temp_join('chain'), fullchain_path=test_util.temp_join('chain'), key_path=test_util.temp_join('privkey'))
    with mock.patch('certbot._internal.cert_manager.lineage_for_certname') as mock_getlin:
        mock_getlin.return_value = mock_lineage
        self._call(['install', '--cert-name', 'whatever', '--key-path', test_util.temp_join('overriding_privkey')], mockisfile=True)
        call_config = mock_install.call_args[0][0]
        self.assertEqual(call_config.cert_path, test_util.temp_join('cert'))
        self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
        self.assertEqual(call_config.chain_path, test_util.temp_join('chain'))
        self.assertEqual(call_config.key_path, test_util.temp_join('overriding_privkey'))
        mock_install.reset()
        self._call(['install', '--cert-name', 'whatever', '--cert-path', test_util.temp_join('overriding_cert')], mockisfile=True)
        call_config = mock_install.call_args[0][0]
        self.assertEqual(call_config.cert_path, test_util.temp_join('overriding_cert'))
        self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
        self.assertEqual(call_config.key_path, test_util.temp_join('privkey'))
@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._install_cert')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_installer_param_override(self, _inst, _rec, mock_install, _):
    mock_lineage = mock.MagicMock(cert_path=test_util.temp_join('cert'), chain_path=test_util.temp_join('chain'), fullchain_path=test_util.temp_join('chain'), key_path=test_util.temp_join('privkey'))
    with mock.patch('certbot._internal.cert_manager.lineage_for_certname') as mock_getlin:
        mock_getlin.return_value = mock_lineage
        self._call(['install', '--cert-name', 'whatever', '--key-path', test_util.temp_join('overriding_privkey')], mockisfile=True)
        call_config = mock_install.call_args[0][0]
        self.assertEqual(call_config.cert_path, test_util.temp_join('cert'))
        self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
        self.assertEqual(call_config.chain_path, test_util.temp_join('chain'))
        self.assertEqual(call_config.key_path, test_util.temp_join('overriding_privkey'))
        mock_install.reset()
        self._call(['install', '--cert-name', 'whatever', '--cert-path', test_util.temp_join('overriding_cert')], mockisfile=True)
        call_config = mock_install.call_args[0][0]
        self.assertEqual(call_config.cert_path, test_util.temp_join('overriding_cert'))
        self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
        self.assertEqual(call_config.key_path, test_util.temp_join('privkey'))