@mock.patch('certbot._internal.cert_manager.domains_for_certname')
@mock.patch('certbot.display.ops.choose_names')
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main._report_new_cert')
def test_find_lineage_for_domains_new_certname(self, mock_report_cert, mock_lineage, mock_choose_names, mock_domains_for_certname):
    mock_lineage.return_value = None
    self._call('certonly --webroot -d example.com -d test.com --cert-name example.com'.split())
    self.assertEqual(mock_lineage.call_count, 1)
    self.assertEqual(mock_report_cert.call_count, 1)
    mock_choose_names.return_value = ['somename']
    mock_domains_for_certname.return_value = None
    self._call('certonly --webroot --cert-name example.com'.split())
    self.assertIs(mock_choose_names.called, True)
@mock.patch('certbot._internal.cert_manager.domains_for_certname')
@mock.patch('certbot.display.ops.choose_names')
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main._report_new_cert')
def test_find_lineage_for_domains_new_certname(self, mock_report_cert, mock_lineage, mock_choose_names, mock_domains_for_certname):
    mock_lineage.return_value = None
    self._call('certonly --webroot -d example.com -d test.com --cert-name example.com'.split())
    self.assertEqual(mock_lineage.call_count, 1)
    self.assertEqual(mock_report_cert.call_count, 1)
    mock_choose_names.return_value = ['somename']
    mock_domains_for_certname.return_value = None
    self._call('certonly --webroot --cert-name example.com'.split())
    self.assertIs(mock_choose_names.called, True)