diff --git a/requirements.txt b/requirements.txt index 11b8e6a3..6bc21ed9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -62,7 +62,7 @@ Jinja2==3.1.2 jsonschema==4.20.0 lxml==4.9.3 MarkupSafe==2.1.3 -mf2py==1.1.3 +mf2py==2.0.1 mf2util==0.5.2 multiformats==0.2.1 multiformats-config==0.2.0.post4 diff --git a/tests/test_web.py b/tests/test_web.py index fde69cae..6ca9928d 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -2520,6 +2520,37 @@ def test_fetch_no_mf2(self, mock_get, __): self.assertFalse(Web.fetch(obj)) self.assertIsNone(obj.as1) + def test_fetch_resolves_relative_urls(self, mock_get, __): + mock_get.return_value = requests_response("""\ + + + +reposted! + +

+ Hello there. +

+ + +""", url='https://user.com/my/post') + + obj = Object(id='https://user.com/post') + Web.fetch(obj) + self.assert_equals({ + 'type': ['h-entry'], + 'properties': { + 'url': ['https://user.com/my/repost'], + 'repost-of': ['https://user.com/orig/post'], + 'author': ['https://user.com/me'], + 'photo': ['https://user.com/my/hi.jpg'], + 'content': [{ + 'html': 'Hello there.', + 'value': 'Hello https://user.com/my/hi.jpg there.', + }], + }, + 'url': 'https://user.com/my/post', + }, obj.mf2) + def test_send_note_does_nothing(self, mock_get, mock_post): Follower.get_or_create( to=self.make_user('https://mas.to/bob', cls=ActivityPub),