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"))
def test_RemediationCreatesElementText(self): remediation = Remediation(self.remediationId, self.remediationText) remediationElement = remediation.toElement() self.assertIsNotNone(remediationElement) self.assertEqual(remediationElement.text, self.remediationText)
def test_RemediationCreatesIdAttribute(self): remediation = Remediation(self.remediationId, self.remediationText) remediationElement = remediation.toElement() self.assertIsNotNone(remediationElement) self.assertEqual(remediationElement.attrib["id"], self.remediationId)