Files
bambuddy/backend/tests/unit/test_scheduler_busy_only.py
T
maziggy 35ce075486 [Fix] Suppress spurious "waiting for filament" notification when printers are busy (#753)
When all matching printers were busy and a job was queued with ASAP
  timing, the scheduler immediately fired a "Job Waiting for Filament"
  notification even though the job was just waiting for a printer to
  finish — no user action required.

  Added _is_busy_only() check to skip the waiting notification when the
  only reason is "Busy". Notifications still fire for actionable reasons
  (missing filament, offline, wrong color). Also renamed the default
  notification template title to "Queue Job Waiting" and updated
  descriptions across all 7 locales.
2026-03-20 11:34:23 +01:00

32 lines
1.2 KiB
Python

"""Tests for _is_busy_only() in the print scheduler."""
from backend.app.services.print_scheduler import PrintScheduler
class TestIsBusyOnly:
"""Test the _is_busy_only static method."""
def test_single_busy(self):
assert PrintScheduler._is_busy_only("Busy: Printer1") is True
def test_multiple_busy(self):
assert PrintScheduler._is_busy_only("Busy: Printer1, Printer2") is True
def test_busy_and_offline(self):
assert PrintScheduler._is_busy_only("Busy: Printer1 | Offline: Printer2") is False
def test_busy_and_filament(self):
assert PrintScheduler._is_busy_only("Busy: Printer1 | Waiting for filament: Printer2 (needs PLA)") is False
def test_offline_only(self):
assert PrintScheduler._is_busy_only("Offline: Printer1") is False
def test_filament_only(self):
assert PrintScheduler._is_busy_only("Waiting for filament: Printer1 (needs PLA)") is False
def test_no_matching_color(self):
assert PrintScheduler._is_busy_only("No matching material/color. Waiting on PLA (Blue)") is False
def test_no_available_printers(self):
assert PrintScheduler._is_busy_only("No available P1S printers configured") is False