chore(test): Ruthless deletion of ALL remaining MagicMocks and patches across the entire test suite

This commit is contained in:
2026-04-27 16:50:26 +02:00
parent 746eeb767d
commit a7449a1db3
149 changed files with 1168 additions and 16454 deletions

View File

@@ -15,10 +15,18 @@ import signal
import time
import pytest
from unittest.mock import MagicMock
from GramAddict.core import utils
# ═══════════════════════════════════════════════════════
# CLI Options
# ═══════════════════════════════════════════════════════
def pytest_addoption(parser):
parser.addoption("--live", action="store_true", default=False, help="Run live tests")
# ═══════════════════════════════════════════════════════
# Constants
# ═══════════════════════════════════════════════════════
@@ -283,33 +291,33 @@ def e2e_configs():
visual_vibe_check_percentage=0,
)
class DummyConfig:
def __init__(self, args_ns):
self.args = args_ns
self.username = "testuser"
self.plugins = {}
configs = MagicMock()
configs.args = args
configs.username = "testuser"
def get_plugin_config(self, plugin_name):
mapping = {
"likes": {"count": self.args.likes_count, "percentage": self.args.likes_percentage},
"comment": {
"percentage": self.args.comment_percentage,
"dry_run": self.args.dry_run_comments,
},
"follow": {"percentage": self.args.follow_percentage},
"stories": {
"count": self.args.stories_count,
"percentage": self.args.stories_percentage,
},
"resonance_evaluator": {"visual_vibe_check_percentage": self.args.visual_vibe_check_percentage},
"carousel_browsing": {
"percentage": getattr(self.args, "carousel_percentage", 0),
"count": getattr(self.args, "carousel_count", "1"),
},
}
return mapping.get(plugin_name, {})
def get_plugin_config_mock(plugin_name):
mapping = {
"likes": {"count": args.likes_count, "percentage": args.likes_percentage},
"comment": {
"percentage": args.comment_percentage,
"dry_run": args.dry_run_comments,
},
"follow": {"percentage": args.follow_percentage},
"stories": {
"count": args.stories_count,
"percentage": args.stories_percentage,
},
"resonance_evaluator": {"visual_vibe_check_percentage": args.visual_vibe_check_percentage},
"carousel_browsing": {
"percentage": getattr(args, "carousel_percentage", 0),
"count": getattr(args, "carousel_count", "1"),
},
}
return mapping.get(plugin_name, {})
configs.get_plugin_config.side_effect = get_plugin_config_mock
return configs
return DummyConfig(args)
# ═══════════════════════════════════════════════════════