Пример #1
0
    def test_specification_to_momspecification_should_raise_exception_if_momspec_is_invalid(self):
        self.validationrpc_mock.return_value = {"valid": False}

        handler = SpecificationTranslationHandler()

        with self.assertRaises(Exception) as exception:
            handler.specification_to_momspecification(self.xml_type1, translation_mode=MODEL_TRANSLATION)

        self.assertEqual(str(exception.exception), "MoM specification validation after translation failed! -> {'valid': False}")
Пример #2
0
    def test_specification_to_momspecification_direct_translation_should_return_expected_type3_mom(self):
        handler = SpecificationTranslationHandler()

        momxml = handler.specification_to_momspecification(self.xml_type3, translation_mode=FULL_TRANSLATION)

        with open(self.expected_momxml_direct_type3, "r+") as f:
            if GENERATE_GOLDEN_OUTPUT:
                f.write(momxml["mom-specification"])
            else:
                assertEqualXML(momxml["mom-specification"], f.read())
Пример #3
0
    def test_specification_to_momspecification_model_translation_should_return_expected_type1_mom_xml_with_constraints(self):
        handler = SpecificationTranslationHandler()

        momxml = handler.specification_to_momspecification(self.xml_type1_minmax, translation_mode=MODEL_TRANSLATION)

        assertEqualXML(momxml["mom-specification"], self.expected_momxml_type1_minmax)