Units — Test Cases
Manual acceptance test cases for the unit flows. See Units concept, QR Codes concept, and the unit guides for context.
TC-UNIT-001 — Add a unit and assign it to a customer
Verifies: Add a Unit
Preconditions:
- Logged in as Office.
- A test customer exists (use the one from TC-CUST-001).
- At least one device model exists.
Steps:
- Navigate to Units -> Add Unit.
- Pick the test customer in
Customer. - Pick a device model in
Model. - Enter
Serial Number:TC-UNIT-001-SN. - Enter
Friendly Name:Test AC #1. - Set
Installed Dateto today. - Set
Warranty (months)to60. - Set
Maintenance FrequencytoQuarterly. - Select Save.
Expected:
- Unit is created and appears in the units list.
- Editing the unit shows the warranty expires 60 months after the install date.
- The customer's edit page lists this unit in its units section.
TC-UNIT-002 — Warranty expiry recomputes when install date changes
Verifies: Units concept
Preconditions:
- The unit from TC-UNIT-001 exists with install date today and 60-month warranty.
Steps:
- Open the unit's edit page.
- Change
Installed Dateto one year ago. - Select Save.
- Reopen the unit's edit page.
Expected:
- Displayed warranty expiry is now ~48 months in the future (60 months minus 1 year).
- No DB column was directly updated; the value is computed from
installed_at + warranty_months.
TC-UNIT-003 — Maintenance frequency none excludes from due list
Verifies: Units concept
Preconditions:
- Logged in as Office.
Steps:
- Create a new unit with
Maintenance Frequencyleft at the default (the-- Select --empty state). - Note the unit's ID.
- Navigate to the maintenance-due report (or filter the units list by "due for maintenance").
Expected:
- The unit does not appear in the due list, regardless of
maintained_atvalue. - A unit with frequency set (e.g. Every month) and a stale
maintained_atdoes appear.
TC-UNIT-004 — Generate a QR code for an existing unit
Verifies: Generate a QR Code, QR Codes concept
Preconditions:
- The unit from TC-UNIT-001 exists without a QR code yet.
Steps:
- Open the unit's edit page.
- Select the Generate QR Code action.
Expected:
- The unit gets a
qr_code_guid(a UUID). - The QR image renders on the page.
- Visiting
/u/<guid>in an incognito browser opens the public unit page (no login required) and shows the friendly name and customer. - The public page exposes no costs, history, or technician info.
TC-UNIT-005 — Print a batch of blank QR labels
Verifies: Print Blank QR Labels
Preconditions:
- Logged in as Office.
Steps:
- Navigate to Units -> Print Blank QR Codes.
- Set quantity to
5. - Generate the print sheet.
Expected:
- A printable sheet renders with 5 distinct QR codes.
- Each code's URL (
/u/<guid>) returns a not-found response if opened directly in a browser before assignment. - The codes do not appear on any unit until a tech scans them from inside TuffOps and assigns them to a unit.
TC-UNIT-006 — Link two units belonging to the same customer
Verifies: Link Related Units, Units concept
Preconditions:
- Two units exist, both belonging to the same customer. Call them A and B.
- Logged in as Office (with
units.edit).
Steps:
- Open unit A's edit page.
- Scroll to the Linked Units section.
- In the dropdown, pick unit B.
- Select Link.
Expected:
- Page reloads. Unit B appears in unit A's Linked Units list.
- Open unit B's edit page — unit A appears in unit B's Linked Units list.
- The units index shows a link group icon next to each.
TC-UNIT-007 — Linking units across customers is rejected (server-side)
Verifies: Link Related Units, commit d5e4a8e and 0a1a2dd
Preconditions:
- Two units exist, each belonging to a different customer. Call them A and B.
- Logged in as Office (with
units.edit).
Steps:
- Open unit A's edit page.
- Even though B should not appear in the dropdown, attempt the request directly (browser dev tools, or via a proxy) by POSTing to
/units/<A-id>/tiewithtied_unit_id=<B-id>.
Expected:
- Response is a redirect with a danger flash message: "Linked units must belong to the same customer."
- No row is created in
unit_ties. - Neither unit's edit page shows the other in Linked Units.
TC-UNIT-008 — Tying a unit to itself is rejected
Verifies: Link Related Units
Preconditions:
- Unit A exists.
- Logged in as Office.
Steps:
- Submit the tie form for unit A with
tied_unit_idequal to A's own ID.
Expected:
- Response is a redirect with a danger flash message: "A unit cannot be linked to itself."
- No row is created in
unit_ties.
TC-UNIT-009 — Tech without units.edit cannot tie units
Verifies: Permission gate added in commit 0a1a2dd
Preconditions:
- Two units exist, same customer. Call them A and B.
- Logged in as a Tech (no
units.editpermission).
Steps:
- Attempt to POST
/units/<A-id>/tiewithtied_unit_id=<B-id>. - Attempt to DELETE
/units/<A-id>/untie/<B-id>.
Expected:
- Both requests return HTTP 403.
- No
unit_tiesrow is added or removed.
TC-UNIT-010 — Transitive linking propagates within the same customer
Verifies: Units concept
Preconditions:
- Three units exist, all belonging to the same customer. Call them A, B, C.
- Logged in as Office.
Steps:
- Tie A to B.
- Tie B to C.
Expected:
- A's Linked Units shows both B and C.
- B's Linked Units shows both A and C.
- C's Linked Units shows both A and B.
- The units index shows a group of size 3 for each.