From 9fb4a25cbba37081e91f32a983593cd499704df6 Mon Sep 17 00:00:00 2001 From: aserper Date: Fri, 12 Dec 2025 23:38:59 -0500 Subject: [PATCH] Fix responses library XML encoding issues - Encode XML strings as UTF-8 bytes for responses library - Add charset to content-type headers - This should fix feedparser XML parsing errors --- test_integration.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test_integration.py b/test_integration.py index d080e06..2c5a367 100644 --- a/test_integration.py +++ b/test_integration.py @@ -58,9 +58,9 @@ class TestRSSFeedIntegration(unittest.TestCase): responses.add( responses.GET, "https://example.com/feed.xml", - body=rss_feed, + body=rss_feed.encode("utf-8"), status=200, - content_type="application/xml", + content_type="application/xml; charset=utf-8", ) # Mock Mastodon instance @@ -103,9 +103,9 @@ class TestRSSFeedIntegration(unittest.TestCase): responses.add( responses.GET, "https://example.com/feed.xml", - body=atom_feed, + body=atom_feed.encode("utf-8"), status=200, - content_type="application/atom+xml", + content_type="application/atom+xml; charset=utf-8", ) mock_instance = Mock() @@ -136,9 +136,9 @@ class TestRSSFeedIntegration(unittest.TestCase): responses.add( responses.GET, "https://example.com/feed.xml", - body=rss_feed, + body=rss_feed.encode("utf-8"), status=200, - content_type="application/xml", + content_type="application/xml; charset=utf-8", ) mock_instance = Mock()