Esempio n. 1
0
 def test_unmatched(self):
     """
     `PolicyExceptionDetail.from_element` returns ``None`` if the element's
     tag is not a policy exception detail.
     """
     elem = L.WhatIsThis(L.foo('a'), L.bar('b'))
     self.assertIdentical(None, PolicyExceptionDetail.from_element(elem))
Esempio n. 2
0
 def test_from_element(self):
     """
     `PolicyExceptionDetail.from_element` returns a `PolicyExceptionDetail`
     instance by parsing a ``PolicyExceptionDetail`` detail element.
     """
     elem = PARLAYX_COMMON_NS.PolicyExceptionDetail(L.messageId('a'),
                                                    L.text('b'),
                                                    L.variables('c'),
                                                    L.variables('d'))
     detail = PolicyExceptionDetail.from_element(elem)
     self.assertEqual(('a', 'b', ['c', 'd']),
                      (detail.message_id, detail.text, detail.variables))