コード例 #1
0
 def test_compile_to_file(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports', 'csv.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'compile_to_file')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
コード例 #2
0
 def test_compile_to_file_jasperreports_functions2(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'Blank_A4_1.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'blank_A4_1')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
コード例 #3
0
 def test_fill_javascript(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'charactersetTestWithJavaScript.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'characterset_test_with_javascript')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
コード例 #4
0
 def test_export_csv(self):
     config = self.get_config_csv()
     instance = Report(config, config.input)
     instance.fill()
     instance.export_csv()
     output_file = config.output + '.csv'
     self.assertEqual(os.path.isfile(output_file), True)
     with open(output_file, 'r') as f:
         rows = f.readlines()
         self.assertEqual(rows[2], '|Name|Street||City|Phone|\n')
コード例 #5
0
 def test_compile_to_file_jasperreports_functions(self):
     config = Config()
     config.input = os.path.join(
         self.RESOURCES_DIR, 'reports',
         'charactersetTestWithStudioBuiltinFunctions.jrxml')
     config.output = os.path.join(
         self.RESOURCES_DIR, 'reports',
         'characterset_test_with_studio_builtin_functions')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
コード例 #6
0
 def test_fill_from_jsonql_datasource(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'jsonql.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports', 'jsonql')
     config.dataFile = os.path.join(self.RESOURCES_DIR, 'contacts.json')
     config.dbType = 'jsonql'
     config.jsonQuery = 'contacts.person'
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
コード例 #7
0
 def test_fill_from_xml_datasource_no_xpath(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'CancelAck.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'cancel_ack_no_xpath')
     config.dataFile = os.path.join(self.RESOURCES_DIR, 'CancelAck.xml')
     config.dbType = 'xml'
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
コード例 #8
0
 def test_export_pdf_barcode4j(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'barcode4j.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'barcode4j')
     config.dataFile = os.path.join(self.RESOURCES_DIR, 'barcode4j.xml')
     config.dbType = 'xml'
     config.xmlXpath = '/nalepka/ident'
     instance = Report(config, config.input)
     instance.fill()
     instance.export_pdf()
     self.assertEqual(os.path.isfile(config.output + '.pdf'), True)
コード例 #9
0
 def test_export_csv_meta(self):
     config = self.get_config_csv()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'csvMeta.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports', 'csvMeta')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_csv_meta()
     output_file = config.output + '.csv'
     self.assertEqual(os.path.isfile(output_file), True)
     with open(output_file, 'r') as f:
         rows = f.readlines()
         self.assertEqual(
             rows[2],
             "Carl Grant|Ap #507-5431 Consectetuer, Avenue|Chippenham|1-472-350-4152\n"
         )
コード例 #10
0
 def test_export_pptx(self):
     config = self.get_config_csv()
     instance = Report(config, config.input)
     instance.fill()
     instance.export_pptx()
     self.assertEqual(os.path.isfile(config.output + '.pptx'), True)