diff options
Diffstat (limited to 'test_moderator.py')
| -rwxr-xr-x | test_moderator.py | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/test_moderator.py b/test_moderator.py index 939d214..af9d4a5 100755 --- a/test_moderator.py +++ b/test_moderator.py @@ -187,15 +187,48 @@ class TestIntelligentModerator(IntelligentModeratorBase): with open(file_path, 'r', encoding='utf-8') as f: content = f.read().strip() + # Parse file content to extract metadata + lines = content.split('\n') + title = file_path.stem.replace('_', ' ').title() + body = content + is_video = False + is_gallery = False + + # Check if file contains metadata markers + if "Title:" in content and "Body:" in content: + # Parse structured content + title_line = None + body_start = None + for i, line in enumerate(lines): + if line.startswith("Title:"): + title_line = line + elif line.startswith("Body:"): + body_start = i + break + + if title_line: + title = title_line.replace("Title:", "").strip() + + if body_start is not None: + body_lines = lines[body_start + 1:] + # Remove metadata lines + body_lines = [line for line in body_lines if not line.startswith(("Has Media:", "Media Type:"))] + body = '\n'.join(body_lines).strip() + + # Check for video indicators in content + content_lower = content.lower() + if "video" in content_lower or "mp4" in content_lower or "webm" in content_lower: + is_video = True + # Create mock submission submission = MockSubmission( id=f"test_{file_path.stem}", - title=file_path.stem.replace('_', ' ').title(), - selftext=content, + title=title, + selftext=body, url="", - is_video=False, + is_video=is_video, is_self=True, - is_gallery=False, + is_gallery=is_gallery, link_flair_text="Roleplay", author=MockAuthor(author_name) ) |