

@mock.patch('acme.challenges.socket.gethostbyname')
@mock.patch('acme.challenges.crypto_util.probe_sni')
def test_probe_cert(self, mock_probe_sni, mock_gethostbyname):
    mock_gethostbyname.return_value = '127.0.0.1'
    self.response.probe_cert('foo.com')
    mock_gethostbyname.assert_called_once_with('foo.com')
    mock_probe_sni.assert_called_once_with(host='127.0.0.1', port=self.response.PORT, name=self.z_domain)
    self.response.probe_cert('foo.com', host='8.8.8.8')
    mock_probe_sni.assert_called_with(host='8.8.8.8', port=mock.ANY, name=mock.ANY)
    self.response.probe_cert('foo.com', port=1234)
    mock_probe_sni.assert_called_with(host=mock.ANY, port=1234, name=mock.ANY)
    self.response.probe_cert('foo.com', bar='baz')
    mock_probe_sni.assert_called_with(host=mock.ANY, port=mock.ANY, name=mock.ANY, bar='baz')
    self.response.probe_cert('foo.com', name=b'xxx')
    mock_probe_sni.assert_called_with(host=mock.ANY, port=mock.ANY, name=self.z_domain)

dataset/ETHPy150Open letsencrypt/letsencrypt/acme/acme/challenges_test.py TLSSNI01ResponseTest.test_probe_cert/original