test_printable_objects_releases_db.py 902 B

12345678910111213141516171819202122
  1. """Skip Objects does not hold a database connection across its FTP download (RC-C9).
  2. For a print started outside Bambuddy the route pulls the 3MF from the
  3. printer -- up to 6 names in 3 folders, from a printer that is mid-print.
  4. A ``Depends(get_db)`` session stayed open idle-in-transaction for all of it.
  5. """
  6. import inspect
  7. import pytest
  8. from backend.app.api.routes import printers
  9. # The connection diagnostic is the same pattern: port, TLS and FTP probes and
  10. # a wait of up to 10 s for the printer to report.
  11. @pytest.mark.parametrize("route", ["get_printable_objects", "diagnose_printer"])
  12. def test_the_route_takes_no_request_long_session(route):
  13. for name, param in inspect.signature(getattr(printers, route)).parameters.items():
  14. assert getattr(param.default, "dependency", None) is not printers.get_db, (
  15. f"{route} holds a get_db session via {name!r} (RC-C9)"
  16. )