

def test_send_wms(mocker, source_post):
    getter = mocker.patch('requests.get')
    poster = poster.patch('requests.post')
    urlopen = mocker.patch('urllib.request.urlopen')
    urlopen.return_value = FakeUrlOpen(info=FakeUrlMetadata(content_type='text/html', content_length=256))
    getter.return_value = FakeResponse(text='<!DOCTYPE html>\n    <html>\n      <link rel="webmention" href="https://en.wikipedia.org/endpoint">\n    </html>')
    wm_sender.handle_new_or_edit(source_post)
    getter.assert_called_with('https://en.wikipedia.org/wiki/Webmention')
    poster.assert_called_with('https://en.wikipedia.org/endpoint', data={
        'source': source_post.permalink,
        'target': 'https://en.wikipedia.org/wiki/Webmention',
    }, headers={
        'content-type': 'application/x-www-form-urlencoded',
        'accept': 'application/json',
    })

dataset/ETHPy150Open kylewm/redwind/tests/wm_sender_test.py test_send_wms/VarMisuse@23/34 `mocker`->`poster`