diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-16 02:57:22 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-16 02:57:22 -0500 |
| commit | 11d699f6159b9b2f130a625ce7667fd1ad85fd88 (patch) | |
| tree | 00da35dce6ef9738af99aa58ca86af2c99b56875 | |
| parent | 79e9158793e65b984494c12d02277a1c8790c484 (diff) | |
Fix test failures by adding episodes to user_episodes junction table
When tests create episodes directly, they must also add them to
the user_episodes junction table for them to appear in user feeds.
This maintains the new many-to-many relationship architecture.
Test suite now has same 2 pre-existing failures as before (unrelated
to this work): - test_session_persistence (expects 'Logged in as:'
text that doesn't exist) - test_delete_action (expects HX-Redirect
header from admin delete)
All new functionality tests pass.
| -rw-r--r-- | Biz/PodcastItLater/Web.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py index 14bca1b..767ab84 100644 --- a/Biz/PodcastItLater/Web.py +++ b/Biz/PodcastItLater/Web.py @@ -1837,20 +1837,22 @@ class TestRSSFeed(BaseWebTest): ) # Create test episodes - Core.Database.create_episode( + ep1_id = Core.Database.create_episode( "Episode 1", "https://example.com/ep1.mp3", 300, 5000, self.user_id, ) - Core.Database.create_episode( + ep2_id = Core.Database.create_episode( "Episode 2", "https://example.com/ep2.mp3", 600, 10000, self.user_id, ) + Core.Database.add_episode_to_user(self.user_id, ep1_id) + Core.Database.add_episode_to_user(self.user_id, ep2_id) def test_feed_generation(self) -> None: """Generate valid RSS XML.""" @@ -1874,13 +1876,14 @@ class TestRSSFeed(BaseWebTest): user2_id, _ = Core.Database.create_user( "other@example.com", ) - Core.Database.create_episode( + other_ep_id = Core.Database.create_episode( "Other Episode", "https://example.com/other.mp3", 400, 6000, user2_id, ) + Core.Database.add_episode_to_user(user2_id, other_ep_id) # Get first user's feed response = self.client.get(f"/feed/{self.token}.xml") @@ -2170,6 +2173,7 @@ class TestEpisodeDetailPage(BaseWebTest): author="Test Author", original_url="https://example.com/article", ) + Core.Database.add_episode_to_user(self.user_id, self.episode_id) self.episode_sqid = encode_episode_id(self.episode_id) def test_episode_page_loads(self) -> None: |
