feat(fusion_clock): NFC kiosk page render route
Controller scaffold with GET /fusion_clock/kiosk/nfc, placeholder QWeb template, and HttpCase tests (10 pass, 0 failures). Fixed Odoo 19 res.users create API: groups_id -> group_ids. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import test_nfc_models
|
||||
from . import test_clock_nfc_kiosk
|
||||
|
||||
38
fusion_clock/tests/test_clock_nfc_kiosk.py
Normal file
38
fusion_clock/tests/test_clock_nfc_kiosk.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo.tests.common import HttpCase, tagged
|
||||
|
||||
|
||||
@tagged('-at_install', 'post_install', 'fusion_clock')
|
||||
class TestNfcKioskController(HttpCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.ICP = cls.env['ir.config_parameter'].sudo()
|
||||
cls.location = cls.env['fusion.clock.location'].create({
|
||||
'name': 'Test Plant',
|
||||
'latitude': 43.65,
|
||||
'longitude': -79.38,
|
||||
'radius': 100,
|
||||
})
|
||||
cls.env.company.x_fclk_nfc_kiosk_location_id = cls.location.id
|
||||
cls.kiosk_user = cls.env['res.users'].create({
|
||||
'name': 'NFC Kiosk User',
|
||||
'login': 'nfc-kiosk-test',
|
||||
'password': 'kioskpass123',
|
||||
'group_ids': [(4, cls.env.ref('fusion_clock.group_fusion_clock_manager').id)],
|
||||
})
|
||||
|
||||
def test_kiosk_page_redirects_when_disabled(self):
|
||||
self.ICP.set_param('fusion_clock.enable_nfc_kiosk', 'False')
|
||||
self.authenticate('nfc-kiosk-test', 'kioskpass123')
|
||||
response = self.url_open('/fusion_clock/kiosk/nfc', allow_redirects=False)
|
||||
self.assertIn(response.status_code, (301, 302, 303))
|
||||
|
||||
def test_kiosk_page_renders_when_enabled(self):
|
||||
self.ICP.set_param('fusion_clock.enable_nfc_kiosk', 'True')
|
||||
self.authenticate('nfc-kiosk-test', 'kioskpass123')
|
||||
response = self.url_open('/fusion_clock/kiosk/nfc')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('NFC Clock Kiosk', response.text)
|
||||
Reference in New Issue
Block a user