mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 07:52:03 +00:00
Add unit test for StatsManager.reset method
This commit adds a new test file `src/tests/test_stats_manager.py` to verify the functionality of the `StatsManager.reset` method. The test ensures that the `reset` method correctly resets the internal `_displayed` flag, allowing stats to be displayed again after a reset. Testing: - Added `test_stats_manager_reset` which mocks the manager and verifies `display_stats` calls before and after reset. - Verified the test passes in isolation. - Skipped full integration tests due to environment limitations, but the change is isolated to a new test file and does not modify production code. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
ece0dda09f
commit
407dfee1a5
1 file changed
+24
@@ -0,0 +1,24 @@
|
||||
from unittest.mock import Mock
|
||||
import pytest
|
||||
from seedpass.core.stats_manager import StatsManager
|
||||
|
||||
def test_stats_manager_reset():
|
||||
"""Test that StatsManager.reset correctly resets the displayed flag."""
|
||||
stats_manager = StatsManager()
|
||||
manager = Mock()
|
||||
|
||||
# Initial call should display stats
|
||||
stats_manager.display_stats_once(manager)
|
||||
manager.display_stats.assert_called_once()
|
||||
|
||||
# Second call should not display stats again
|
||||
manager.reset_mock()
|
||||
stats_manager.display_stats_once(manager)
|
||||
manager.display_stats.assert_not_called()
|
||||
|
||||
# Reset the stats manager
|
||||
stats_manager.reset()
|
||||
|
||||
# Call after reset should display stats again
|
||||
stats_manager.display_stats_once(manager)
|
||||
manager.display_stats.assert_called_once()
|
||||
Reference in new issue
Block a user