v3.12.0: the card preset carries the card's CAT (USAT) release
The release selector lives in the preset rather than a global chip: presets already travel with the card (ICCID auto-selection, export/import), and the operations that will consume the release are preset-aware. - presets.py: the optional `release` field (4-18; empty = unspecified) joins PRESET_FIELDS; a value outside 4-18 is refused on save/import; the store schema version is 5. - catrelease.py: DEFAULT_RELEASE = 12 and preset_release() - the effective release is the preset's own value, else Rel-12 (the safe level for cards whose release is not known; an unset release never filters anything away). The PWA mirrors both (CAT_RELEASE_DEFAULT + presetRelease()), drift-guarded. - Cards tab: the editor's header row gains a compact CAT release select (unspecified / pre-Rel-6 stored as 5 / Rel-6 ... Rel-18); the empty option names the Rel-12 default and the tooltip explains the guard; the field is collected, cleared and restored with the other form fields. - Nothing filters yet: the Simulator's event parameters (stage 3) will use the effective release. - docs/api.md + help EN/RU updated; sw cache simple-v368.
This commit is contained in:
@@ -234,6 +234,21 @@ class StoreCrudTests(unittest.TestCase):
|
||||
self.assertEqual(p['pin1'], '1234')
|
||||
self.assertEqual(p['puk1'], '12345678')
|
||||
|
||||
def test_release_is_optional_and_must_be_4_to_18(self):
|
||||
p = self.store.add(preset())
|
||||
self.assertEqual(p['release'], '')
|
||||
p = self.store.add(preset(name='Rel', release='14'))
|
||||
self.assertEqual(p['release'], '14')
|
||||
# numbers arrive as strings from the form and as ints from the API
|
||||
p = self.store.add(preset(name='Int', release=4))
|
||||
self.assertEqual(p['release'], '4')
|
||||
p = self.store.add(preset(name='Top', release=' 18 '))
|
||||
self.assertEqual(p['release'], '18')
|
||||
for bad in ('3', '19', '0', '20', 'abc', '1x', '012'):
|
||||
with self.assertRaises(presets.PresetError) as ctx:
|
||||
self.store.add(preset(name='X', release=bad))
|
||||
self.assertIn('release', str(ctx.exception))
|
||||
|
||||
def test_duplicate_iccid_is_refused_across_stored_forms(self):
|
||||
self.store.add(preset(iccid=DIGITS))
|
||||
with self.assertRaises(presets.PresetError) as ctx:
|
||||
|
||||
Reference in New Issue
Block a user