test: drop side_effect padding to match collapsed time.time() call

This commit is contained in:
Trevin Chow
2026-05-16 23:39:14 -07:00
parent ecf68347db
commit 36c43d50b7
+4 -4
View File
@@ -213,10 +213,10 @@ class TestPollDeviceAuth:
@patch("lib.setup_wizard.urlopen") @patch("lib.setup_wizard.urlopen")
def test_timeout_returns_none(self, mock_urlopen, mock_time): def test_timeout_returns_none(self, mock_urlopen, mock_time):
"""Returns None when timeout is exceeded.""" """Returns None when timeout is exceeded."""
# poll_device_auth calls time.time() for deadline init, last_reminder init, # poll_device_auth captures started_at once, derives deadline + last_reminder
# then once per while-loop iteration. Three values are enough for one check # from it, then checks time.time() in the while-loop. Two values: started_at,
# that exceeds the deadline. # then a value past the deadline so the loop exits immediately.
mock_time.time = MagicMock(side_effect=[0, 0, 301]) mock_time.time = MagicMock(side_effect=[0, 301])
mock_time.sleep = MagicMock() mock_time.sleep = MagicMock()
result = setup_wizard.poll_device_auth("dc-123", interval=5, timeout=300) result = setup_wizard.poll_device_auth("dc-123", interval=5, timeout=300)