Browse Source

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 days ago
parent
commit
eb98521e93
1 changed files with 1 additions and 1 deletions
  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()
         archive = PrintArchive(
             filename="ghost.3mf",
-            file_path="/tmp/nope-does-not-exist.3mf",
+            file_path="/nonexistent/ghost.3mf",
             file_size=0,
             status="completed",
         )