feat(fusion_plating_shopfloor): /fp/tablet/tiles + /fp/tablet/ping endpoints (P6.1.4-P6.1.5)
Tiles returns the lock-screen grid: operator-group users, sorted clocked-in-first then alphabetical, with avatar URL + has_pin flag. Honours station.x_fc_authorised_user_ids when non-empty (Phase 6.1.6 adds that field). Ping is a lightweight ack used by FpTabletLock as a heartbeat — logs current_tech_id at DEBUG for forensic visibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -181,3 +181,36 @@ class TestTabletUnlock(HttpCase):
|
||||
res = self._unlock('1234')
|
||||
self.assertFalse(res['ok'])
|
||||
self.assertTrue(res.get('needs_setup'))
|
||||
|
||||
|
||||
@tagged('-at_install', 'post_install', 'fp_shopfloor', 'fp_tablet_pin')
|
||||
class TestTabletTiles(HttpCase):
|
||||
"""P6.1.4 — /fp/tablet/tiles endpoint."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.authenticate("admin", "admin")
|
||||
self.op_group = self.env.ref('fusion_plating.group_fusion_plating_operator')
|
||||
self.alice = self.env['res.users'].create({
|
||||
'name': 'Alice Tile', 'login': 'alice_tile@example.com',
|
||||
'group_ids': [(6, 0, [self.op_group.id])],
|
||||
})
|
||||
self.bob = self.env['res.users'].create({
|
||||
'name': 'Bob Tile', 'login': 'bob_tile@example.com',
|
||||
'group_ids': [(6, 0, [self.op_group.id])],
|
||||
})
|
||||
self.alice.sudo().set_tablet_pin('1111')
|
||||
|
||||
def test_tiles_returns_all_operators_without_station(self):
|
||||
res = _rpc(self, '/fp/tablet/tiles')
|
||||
self.assertTrue(res['ok'])
|
||||
names = [t['name'] for t in res['tiles']]
|
||||
self.assertIn('Alice Tile', names)
|
||||
self.assertIn('Bob Tile', names)
|
||||
|
||||
def test_tile_has_pin_flag(self):
|
||||
res = _rpc(self, '/fp/tablet/tiles')
|
||||
alice_tile = next(t for t in res['tiles'] if t['name'] == 'Alice Tile')
|
||||
bob_tile = next(t for t in res['tiles'] if t['name'] == 'Bob Tile')
|
||||
self.assertTrue(alice_tile['has_pin'])
|
||||
self.assertFalse(bob_tile['has_pin'])
|
||||
|
||||
Reference in New Issue
Block a user