Exemplo n.º 1
0
class Test_RemediationToSubElement(unittest.TestCase):
    def setUp(self):
        self.penaltyName = "name"
        self.value = 1
        self.reasons = "I have my reasons"
        self.penaltyId = "penaltyId"
        self.remediationText = "This is how you do better"
        self.remediation = Remediation(self.penaltyId, self.remediationText)

        self.penalty = Penalty(self.penaltyName, self.value, self.reasons,
                               self.remediation, self.penaltyId)

    def tearDown(self):
        pass

    def test_RemediationAsChildElementHasAParent(self):
        element = ET.Element("top")
        self.remediation.toElement(element)

        self.assertIsNotNone(element.find("remediation"))
Exemplo n.º 2
0
 def test_RemediationCreatesElementText(self):
     remediation = Remediation(self.remediationId, self.remediationText)
     remediationElement = remediation.toElement()
     
     self.assertIsNotNone(remediationElement)
     self.assertEqual(remediationElement.text, self.remediationText)
Exemplo n.º 3
0
 def test_RemediationCreatesIdAttribute(self):
     remediation = Remediation(self.remediationId, self.remediationText)
     remediationElement = remediation.toElement()
     
     self.assertIsNotNone(remediationElement)
     self.assertEqual(remediationElement.attrib["id"], self.remediationId)