Adding Manual connection point to allow undeclared fits
This commit is contained in:
1 parent
7e246be39c
commit
b4dcb68bea
15 files changed
+227
-23
No files matched your search
@@ -284,6 +284,41 @@ async def test_fit_reference_without_attachment_points_creates_matching_one(
|
||||
assert acc_aps[0].id in linked_ap_ids
|
||||
|
||||
|
||||
async def test_scope_fit_without_scope_attachment_point_creates_manual_one(
|
||||
db_sessionmaker,
|
||||
):
|
||||
async with db_sessionmaker() as db:
|
||||
_, acc_ap = await _make_accessory(db, "ACC-1", od_mm=40)
|
||||
|
||||
# No ocular_outer_diameter_mm, so the scope itself has no Ocular AP,
|
||||
# but an ocular_fit reference is still given.
|
||||
data = _workbook(
|
||||
[_scope_row(ocular_outer_diameter_mm=None, ocular_fit="ACC-1")]
|
||||
)
|
||||
result = await scope_import_service.import_from_bytes(db, data)
|
||||
assert result.created == 1
|
||||
msgs = " ".join(result.rows[0].messages)
|
||||
assert "created a manual one to record the fit" in msgs
|
||||
|
||||
part = await augmented_part_crud.get_by_sku(db, "SCOPE-A")
|
||||
scope_aps = await attachment_point_crud.list_for_augmented_part(db, part.id)
|
||||
by_label = {ap.attachment_point_name.name: ap for ap in scope_aps}
|
||||
assert "Ocular" in by_label
|
||||
ocular_ap = by_label["Ocular"]
|
||||
assert ocular_ap.iso_thread is None
|
||||
assert ocular_ap.unc_thread is None
|
||||
assert ocular_ap.clamp_connection is None
|
||||
assert ocular_ap.static_connection is None
|
||||
# Objective still gets its normal thread-based AP.
|
||||
assert "Objective" in by_label
|
||||
|
||||
fits = await fit_crud.list_for_part(db, part.id)
|
||||
assert len(fits) == 1
|
||||
linked_ap_ids = {fits[0].attachment_point_a_id, fits[0].attachment_point_b_id}
|
||||
assert ocular_ap.id in linked_ap_ids
|
||||
assert acc_ap.id in linked_ap_ids
|
||||
|
||||
|
||||
async def test_unc_objective_thread_creates_unc_attachment_point(db_sessionmaker):
|
||||
async with db_sessionmaker() as db:
|
||||
data = _workbook([_scope_row(objective_thread="1.750-32 UNS")])
|
||||
|
||||
Reference in new issue
Block a user