def test_method_get_status(self): docx_report_template = ReportDocxTemplateFactory() pptx_report_template = ReportPptxTemplateFactory() try: status = docx_report_template.get_status() self.assertEqual("success", status) except Exception: self.fail( "ReportTemplate model `get_status` method failed unexpectedly with DOCX template!" ) try: status = pptx_report_template.get_status() self.assertEqual("success", status) except Exception: self.fail( "ReportTemplate model `get_status` method failed unexpectedly with PPTX template!" )
def setUpTestData(cls): cls.valid_docx_template = ReportDocxTemplateFactory() cls.valid_pptx_template = ReportPptxTemplateFactory() cls.invalid_docx_template = ReportDocxTemplateFactory() cls.invalid_docx_template.lint_result = { "result": "failed", "warnings": [], "errors": [] } cls.invalid_docx_template.save() cls.invalid_pptx_template = ReportPptxTemplateFactory() cls.invalid_pptx_template.lint_result = { "result": "failed", "warnings": [], "errors": [] } cls.invalid_pptx_template.save() cls.config = ReportConfigurationFactory( default_docx_template_id=cls.valid_docx_template.pk, default_pptx_template_id=cls.valid_pptx_template.pk)
def test_clean_template_signal(self): template = ReportDocxTemplateFactory() new_template = ReportPptxTemplateFactory() template.document = new_template.document template.doc_type = new_template.doc_type template.save() self.assertTrue(template._current_template.path not in template.document.path) self.assertFalse(os.path.exists(template._current_template.path)) self.assertTrue(os.path.exists(template.document.path))
def setUpTestData(cls): cls.report = ReportFactory( docx_template=ReportDocxTemplateFactory(), pptx_template=ReportPptxTemplateFactory(), ) cls.high_severity = SeverityFactory(severity="High", weight=1) cls.critical_severity = SeverityFactory(severity="Critical", weight=0) cls.user = UserFactory(password=PASSWORD) cls.new_user = UserFactory(password=PASSWORD) cls.num_of_findings = 10 cls.findings = [] for finding_id in range(cls.num_of_findings): title = f"Finding {finding_id}" cls.findings.append(ReportFindingLinkFactory(title=title, report=cls.report)) cls.uri = reverse("reporting:local_edit", kwargs={"pk": cls.findings[0].pk})
def setUpTestData(cls): cls.config = ReportConfigurationFactory() cls.docx_template = ReportDocxTemplateFactory() cls.pptx_template = ReportPptxTemplateFactory()