mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 19:02:31 +00:00
test: install JSON Schema validator for offline OCI regressions
This commit is contained in:
@@ -50,6 +50,22 @@ class TechnicalMessages(unittest.TestCase):
|
|||||||
self.assertTrue(raw.startswith('La plantilla generada no cumple el esquema:'))
|
self.assertTrue(raw.startswith('La plantilla generada no cumple el esquema:'))
|
||||||
self.assertEqual(i18n.diagnostic(caught.exception), 'Vygenerovaná šablóna nezodpovedá schéme:' + raw.split(':', 1)[1])
|
self.assertEqual(i18n.diagnostic(caught.exception), 'Vygenerovaná šablóna nezodpovedá schéme:' + raw.split(':', 1)[1])
|
||||||
|
|
||||||
|
def test_missing_schema_validator_is_distinct_from_invalid_schema_without_effects(self):
|
||||||
|
template = {}
|
||||||
|
read = self.patch(Path, 'read_text', side_effect=AssertionError('schema must not be read without a validator'))
|
||||||
|
with patch.dict(sys.modules, {'jsonschema': None}):
|
||||||
|
with self.assertRaises(converter.ConversionError) as caught:
|
||||||
|
self.catalog.validate(template)
|
||||||
|
raw = 'python3-jsonschema is required to generate templates'
|
||||||
|
self.assertEqual(str(caught.exception), raw)
|
||||||
|
self.assertEqual(i18n.diagnostic(caught.exception), 'Na generovanie šablón je potrebný python3-jsonschema')
|
||||||
|
self.assertEqual(str(caught.exception), raw)
|
||||||
|
self.assertIsNone(self.catalog.validate(template, required=False))
|
||||||
|
read.assert_not_called()
|
||||||
|
self.assertEqual(template, {})
|
||||||
|
for effect in self.effects:
|
||||||
|
effect.assert_not_called()
|
||||||
|
|
||||||
def test_real_casaos_error_preserves_the_protocol_and_localizes_the_message(self):
|
def test_real_casaos_error_preserves_the_protocol_and_localizes_the_message(self):
|
||||||
with self.assertRaises(converter.ConversionError) as caught:
|
with self.assertRaises(converter.ConversionError) as caught:
|
||||||
casaos.parse_casaos_compose('[]')
|
casaos.parse_casaos_compose('[]')
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
test -x /bin/bash
|
test -x /bin/bash
|
||||||
test -x /usr/bin/jq
|
test -x /usr/bin/jq
|
||||||
- name: Install OCI wording test dependency
|
- name: Install OCI wording test dependencies
|
||||||
run: python3 -m pip install 'PyYAML>=6,<7'
|
run: python3 -m pip install 'PyYAML>=6,<7' 'jsonschema==4.25.1'
|
||||||
- name: Run offline i18n and script regressions
|
- name: Run offline i18n and script regressions
|
||||||
env:
|
env:
|
||||||
PYTHONDONTWRITEBYTECODE: '1'
|
PYTHONDONTWRITEBYTECODE: '1'
|
||||||
|
|||||||
Reference in New Issue
Block a user