Spool page for NFC links, bridge address; vendor-first new spool form
CI / test (push) Successful in 2m29s
CI / image (push) Successful in 39s

- /s/<id> shows a spool: rest in Spoolman and CC2 Control, where it is,
  last booking, history, links to Spoolman and the tag generator.
- Setting "Adresse der Bridge"; the tag generator can put <address>/s/<id>
  on the tag, so an iPhone held to the roll opens that page.
- New spool: vendor and material chosen from Spoolman, the vendor's
  filaments offered, values taken from similar filaments, duplicates
  pointed out and never created twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014GcEk5tkfFSYD6NTF66NkC
This commit is contained in:
Jonas MenzelandClaude Opus 5.5 committed 2026-10-25 21:52:23 +01:00
1 parent b37cd64909
commit 64ea91d107
10 files changed
+304 -49

No files matched your search

+18
View File
@@ -161,6 +161,24 @@ def test_create_spool_with_new_filament_and_vendor(tmp_path):
fil = [x[1] for x in sm.calls if x[0] == "create_filament"][0]
assert fil["color_hex"] == "1A1A1A" and fil["settings_extruder_temp"] == 210 and fil["vendor_id"] == 2
assert ("create_vendor", {"name": "Elegoo", "empty_spool_weight": 154.0}) in sm.calls
again = c.post("/api/spoolman/create", json=dict(body, vendor="ELEGOO", name="pla matte black"), headers=H)
assert again.status_code == 200 and len([x for x in sm.calls if x[0] == "create_filament"]) == 1 # reused
assert len([x for x in sm.calls if x[0] == "create_vendor"]) == 1
bad = dict(body, color="red")
assert c.post("/api/spoolman/create", json=bad, headers=H).status_code == 400
assert c.post("/api/spoolman/create", json=dict(body, count=50), headers=H).status_code == 400
def test_public_url_and_spool_page(tmp_path):
c, bridge = make_client(tmp_path)
assert c.post("/api/settings", json={"public_url": "cc2.menzel.center"}, headers=H).status_code == 400
r = c.post("/api/settings", json={"public_url": "https://cc2.menzel.center/"}, headers=H)
assert r.json()["public_url"] == "https://cc2.menzel.center"
assert c.get("/s/5").status_code == 200
d = c.get("/api/spool/5").json()
assert d["spool"]["id"] == 5 and d["slot"] is None and d["spoolman_url"].endswith("/spool/show/5")
assert c.get("/api/spool/99").status_code == 404
url = "https://cc2.menzel.center/s/5"
t = c.post("/api/tag", json={"spool_id": 5, "material": "PLA", "subtype": 1, "color": "000000", "temp_min": 190,
"temp_max": 230, "url": url}, headers=H).json()
assert t["decoded"]["url"] == url and t["decoded"]["spool_id"] == 5