Преглед изворни кода

fix(test): use /nonexistent/ instead of /tmp/ to satisfy Bandit B108

  The test_returns_empty_when_3mf_missing test sets a deliberately
  non-existent file_path on a PrintArchive to verify
  compute_deficit_for_queue_item handles the missing-3MF branch
  gracefully. The path just needs to fail an existence check — the
  /tmp/ prefix was incidental.

  Bandit B108 ("insecure temp file usage") regex-matches /tmp/,
  /var/tmp/, and /dev/shm/. Dropping /tmp/ in favour of /nonexistent/
  keeps the test behaviour identical (still a guaranteed-missing
  path, still triggers the missing-file branch) while clearing the
  GitHub Advanced Security finding on PR #1514 without adding a
  # nosec annotation.
maziggy пре 3 дана
родитељ
комит
02e119ea45
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      backend/tests/unit/services/test_filament_deficit.py

+ 1 - 1
backend/tests/unit/services/test_filament_deficit.py

@@ -223,7 +223,7 @@ class TestFilamentDeficit:
         printer = await printer_factory()
         printer = await printer_factory()
         archive = PrintArchive(
         archive = PrintArchive(
             filename="ghost.3mf",
             filename="ghost.3mf",
-            file_path="/tmp/nope-does-not-exist.3mf",
+            file_path="/nonexistent/ghost.3mf",
             file_size=0,
             file_size=0,
             status="completed",
             status="completed",
         )
         )