def test_helper_generateXml(self): print 'Running %s ...' % getName() sequenceListing = self.sequenceListingFixture.create_sequencelisting_instance() self.sequenceListingFixture.create_sequence_instance(sequenceListing) # TODO: generate some fancy sequences to check xml validation? util.helper_generateXml(sequenceListing) f = os.path.join(util.OUTPUT_DIR, '%s.xml' % sequenceListing.fileName) self.assertTrue(util.validateDocumentWithSchema(f, util.XML_SCHEMA_PATH)) self.assertTrue(util.validateDocumentWithDtd(f, util.XML_DTD_PATH)) sequenceListing.delete()
def generateXml(request, pk): sl = SequenceListing.objects.all().get(pk=pk) sl.productionDate = timezone.now() sl.save() # generate xml and write it to file system util.helper_generateXml(sl) xmlFilePath = 'sequencelistings/output/%s.xml' % sl.fileName logger.info('Generated xml seql at %s.' %xmlFilePath) return render(request, 'sequencelistings/xmloutput.html', {'filePath': xmlFilePath, 'location': util.OUTPUT_DIR, 'fileName': sl.fileName, })
def test_helper_generateXml(self): print 'Running %s ...' % getName() sequenceListing = self.sequenceListingFixture.create_sequencelisting_instance( ) self.sequenceListingFixture.create_sequence_instance(sequenceListing) # TODO: generate some fancy sequences to check xml validation? util.helper_generateXml(sequenceListing) f = os.path.join(util.OUTPUT_DIR, '%s.xml' % sequenceListing.fileName) res = util.validateDocumentWithSchema(f, util.XML_SCHEMA_PATH) self.assertIsNone(res['parserError']) self.assertIsNone(res['schemaError']) self.assertTrue(util.validateDocumentWithDtd(f, util.XML_DTD_PATH)) sequenceListing.delete() # TODO: shouldn't be in teardown?
def generateXml(request, pk): sl = SequenceListing.objects.all().get(pk=pk) sl.productionDate = timezone.now() sl.save() # generate xml and write it to file system util.helper_generateXml(sl) xmlFilePath = 'sequencelistings/output/%s.xml' % sl.fileName logger.info('Generated xml seql at %s.' % xmlFilePath) return render( request, 'sequencelistings/xmloutput.html', { 'filePath': xmlFilePath, 'location': util.OUTPUT_DIR, 'fileName': sl. fileName, # can be obtained in the template from sequencelisting!!!! 'sequencelisting': sl, })