From e329252465aa35db877eb831fb448cc6df640ba0 Mon Sep 17 00:00:00 2001 From: aserper Date: Fri, 12 Dec 2025 23:36:38 -0500 Subject: [PATCH] Fix XML indentation in integration tests - Remove dedent() and use raw XML strings starting at column 0 - This fixes the XML parsing errors in all integration tests - Remove unused textwrap import --- test_integration.py | 157 ++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 84 deletions(-) diff --git a/test_integration.py b/test_integration.py index b903a3a..d080e06 100644 --- a/test_integration.py +++ b/test_integration.py @@ -5,7 +5,6 @@ from unittest.mock import Mock, patch import tempfile import os import time -from textwrap import dedent from bot import MastodonRSSBot import responses import feedparser @@ -37,26 +36,24 @@ class TestRSSFeedIntegration(unittest.TestCase): def test_end_to_end_rss_to_mastodon(self, mock_mastodon): """Test complete flow from RSS feed to Mastodon post""" # Mock RSS feed response - rss_feed = dedent( - """ - - - Test Feed - https://example.com - Test RSS Feed - - First Article - https://example.com/article1 - This is the first article - - - Second Article - https://example.com/article2 - This is the second article - - - """ - ).strip() + rss_feed = """ + + + Test Feed + https://example.com + Test RSS Feed + + First Article + https://example.com/article1 + This is the first article + + + Second Article + https://example.com/article2 + This is the second article + + +""" responses.add( responses.GET, @@ -89,21 +86,19 @@ class TestRSSFeedIntegration(unittest.TestCase): @patch("bot.Mastodon") def test_atom_feed_parsing(self, mock_mastodon): """Test parsing Atom feeds""" - atom_feed = dedent( - """ - - Test Atom Feed - - 2024-01-01T00:00:00Z - - Atom Article - - https://example.com/atom1 - 2024-01-01T00:00:00Z - This is an atom article - - """ - ).strip() + atom_feed = """ + + Test Atom Feed + + 2024-01-01T00:00:00Z + + Atom Article + + https://example.com/atom1 + 2024-01-01T00:00:00Z + This is an atom article + +""" responses.add( responses.GET, @@ -127,18 +122,16 @@ class TestRSSFeedIntegration(unittest.TestCase): @patch("bot.Mastodon") def test_persistence_across_runs(self, mock_mastodon): """Test that processed entries persist across multiple bot runs""" - rss_feed = dedent( - """ - - - Test Feed - - Article 1 - https://example.com/1 - - - """ - ).strip() + rss_feed = """ + + + Test Feed + + Article 1 + https://example.com/1 + + +""" responses.add( responses.GET, @@ -169,22 +162,20 @@ class TestRSSFeedIntegration(unittest.TestCase): def test_incremental_feed_updates(self, mock_mastodon): """Test handling of new entries added to feed over time""" # Initial feed with 2 articles - initial_feed = dedent( - """ - - - Test Feed - - Article 1 - https://example.com/1 - - - Article 2 - https://example.com/2 - - - """ - ).strip() + initial_feed = """ + + + Test Feed + + Article 1 + https://example.com/1 + + + Article 2 + https://example.com/2 + + +""" responses.add( responses.GET, @@ -204,26 +195,24 @@ class TestRSSFeedIntegration(unittest.TestCase): # Update feed with 1 new article responses.reset() - updated_feed = dedent( - """ - - - Test Feed - - Article 3 - https://example.com/3 - - - Article 2 - https://example.com/2 - - - Article 1 - https://example.com/1 - - - """ - ).strip() + updated_feed = """ + + + Test Feed + + Article 3 + https://example.com/3 + + + Article 2 + https://example.com/2 + + + Article 1 + https://example.com/1 + + +""" responses.add( responses.GET,