def test_monitor_heartbeats_remove_participant(_mock_sleep, _mock_event): participants = Participants() participants.add("participant_1") participants.participants["participant_1"].heartbeat_expires = 0 coordinator = Coordinator() coordinator.participants = participants terminate_event = threading.Event() monitor_heartbeats(coordinator, terminate_event) assert participants.len() == 0
def test_monitor_heartbeats(mock_participants_remove, _mock_sleep, _mock_event): participants = Participants() participants.add("participant_1") participants.participants["participant_1"].heartbeat_expires = 0 coordinator = Coordinator() coordinator.participants = participants terminate_event = threading.Event() monitor_heartbeats(coordinator, terminate_event) mock_participants_remove.assert_called_once_with("participant_1")