def test_xml(self): step = IFProvenanceStep( 'TEST title', 'TEST &" \' < > description', data=self.good_data, timestamp='2015-08-13T20:20:48.178268') self.assertEqual(self.good_data_xml, step.xml)
def append_if_provenance_step(self, title, description, timestamp=None, data=None): """Append a new IF provenance step. :param title: the title of the IF ProvenanceStep :type title: str :param description: the description of the IF ProvenanceStep :type description: str :param timestamp: the time of the IF ProvenanceStep :type timestamp: datetime, None :param data: The data of the IF ProvenanceStep :type data: dict :returns: the time of the IF ProvenanceStep :rtype: datetime """ step = IFProvenanceStep(title, description, timestamp, data) self._steps.append(step) return step.time
def test_invalid_data(self): with self.assertRaises(InvalidProvenanceDataError): IFProvenanceStep('TEST title', 'TEST description', data={}) partial_data = { 'start_time': '20140714_060955', 'finish_time': '20140714_061255', 'hazard_layer': 'path/to/hazard/layer', 'exposure_layer': 'path/to/exposure/layer', 'impact_function_id': 'impact_function_id', } with self.assertRaises(InvalidProvenanceDataError): IFProvenanceStep('TEST title', 'TEST description', data=partial_data) IFProvenanceStep('TEST title', 'TEST description', data=self.good_data)