def testReportFileType(self): new_report = Report( status=Report.CREATED, secondary_category=self.secondary_category, category=self.category, description="Just a test", postalcode=1000, address="my address", point=dict_to_point({"x": "149776", "y": "170105"}), address_number="6h", created_by=self.manager_etterbeek, ) new_report.save() reportFile = ReportFile(file_type=ReportFile.PDF, report=new_report) self.assertTrue(reportFile.is_pdf()) self.assertFalse(reportFile.is_word()) self.assertFalse(reportFile.is_excel()) self.assertFalse(reportFile.is_image()) self.assertTrue(reportFile.is_document()) reportFile = ReportFile(file_type=ReportFile.WORD, report=new_report) self.assertFalse(reportFile.is_pdf()) self.assertTrue(reportFile.is_word()) self.assertFalse(reportFile.is_excel()) self.assertFalse(reportFile.is_image()) self.assertTrue(reportFile.is_document()) reportFile = ReportFile(file_type=ReportFile.EXCEL, report=new_report) self.assertFalse(reportFile.is_pdf()) self.assertFalse(reportFile.is_word()) self.assertTrue(reportFile.is_excel()) self.assertFalse(reportFile.is_image()) self.assertTrue(reportFile.is_document()) reportFile = ReportFile(file_type=ReportFile.IMAGE, report=new_report) self.assertFalse(reportFile.is_pdf()) self.assertFalse(reportFile.is_word()) self.assertFalse(reportFile.is_excel()) self.assertTrue(reportFile.is_image()) self.assertFalse(reportFile.is_document())
def testReportFileType(self): new_report = Report( status=Report.CREATED, secondary_category=self.secondary_category, category=self.category, description='Just a test', postalcode=1000, address='my address', point=dict_to_point({"x": '149776', "y": '170105'}), address_number='6h', created_by=self.manager_etterbeek ) new_report.save() reportFile = ReportFile(file_type=ReportFile.PDF, report=new_report) self.assertTrue(reportFile.is_pdf()) self.assertFalse(reportFile.is_word()) self.assertFalse(reportFile.is_excel()) self.assertFalse(reportFile.is_image()) self.assertTrue(reportFile.is_document()) reportFile = ReportFile(file_type=ReportFile.WORD, report=new_report) self.assertFalse(reportFile.is_pdf()) self.assertTrue(reportFile.is_word()) self.assertFalse(reportFile.is_excel()) self.assertFalse(reportFile.is_image()) self.assertTrue(reportFile.is_document()) reportFile = ReportFile(file_type=ReportFile.EXCEL, report=new_report) self.assertFalse(reportFile.is_pdf()) self.assertFalse(reportFile.is_word()) self.assertTrue(reportFile.is_excel()) self.assertFalse(reportFile.is_image()) self.assertTrue(reportFile.is_document()) reportFile = ReportFile(file_type=ReportFile.IMAGE, report=new_report) self.assertFalse(reportFile.is_pdf()) self.assertFalse(reportFile.is_word()) self.assertFalse(reportFile.is_excel()) self.assertTrue(reportFile.is_image()) self.assertFalse(reportFile.is_document())