def test_verify_with_type(self): self.gmp.verify_report_format(ReportFormatType.SVG) report_format_id = get_report_format_id_from_string('svg').value self.connection.send.has_been_called_with( '<verify_report_format report_format_id="{}"/>'.format( report_format_id))
def test_get_report_with_report_format_type(self): self.gmp.get_report(report_id='r1', report_format_id=ReportFormatType.TXT) report_format_id = get_report_format_id_from_string('txt').value self.connection.send.has_been_called_with( '<get_reports report_id="r1" format_id="{}" details="1"/>'.format( report_format_id))
def test_modify_report_format_with_name_and_type(self): self.gmp.modify_report_format(report_format_id=ReportFormatType.XML, name='foo') report_format_id = get_report_format_id_from_string('xml').value self.connection.send.has_been_called_with( '<modify_report_format report_format_id="{}">' '<name>foo</name>' '</modify_report_format>'.format(report_format_id))
def test_trigger_alert_with_report_format_type(self): self.gmp.trigger_alert(alert_id="a1", report_id='r1', report_format_id=ReportFormatType.SVG) report_format_id = get_report_format_id_from_string('svg').value self.connection.send.has_been_called_with( '<get_reports report_id="r1" alert_id="a1" ' 'format_id="{}"/>'.format(report_format_id))
def test_clone_with_type(self): self.gmp.clone_report_format(ReportFormatType.SVG) report_format_id = get_report_format_id_from_string('svg').value self.connection.send.has_been_called_with( '<create_report_format>' '<copy>{}</copy>' '</create_report_format>'.format(report_format_id) )
def test_get_report_format_type(self): self.gmp.get_report_format(ReportFormatType.PDF) report_format_id = get_report_format_id_from_string('pdf').value self.connection.send.has_been_called_with( '<get_report_formats ' 'report_format_id="{}" details="1"/>'.format(report_format_id)) self.gmp.get_report_format(report_format_id=ReportFormatType.PDF) self.connection.send.has_been_called_with( '<get_report_formats ' 'report_format_id="{}" details="1"/>'.format(report_format_id))
def test_nbe(self): ct = get_report_format_id_from_string('nbe') self.assertEqual(ct, ReportFormatType.NBE)
def test_latex(self): ct = get_report_format_id_from_string('latex') self.assertEqual(ct, ReportFormatType.LATEX)
def test_itg(self): ct = get_report_format_id_from_string('itg') self.assertEqual(ct, ReportFormatType.ITG)
def test_gxcr_pdf(self): ct = get_report_format_id_from_string('gxcr pdf') self.assertEqual(ct, ReportFormatType.GXCR_PDF)
def test_gsr_html(self): ct = get_report_format_id_from_string('gsr html') self.assertEqual(ct, ReportFormatType.GSR_HTML)
def test_verinice_itg(self): ct = get_report_format_id_from_string('verinice itg') self.assertEqual(ct, ReportFormatType.VERINICE_ITG)
def test_txt(self): ct = get_report_format_id_from_string('txt') self.assertEqual(ct, ReportFormatType.TXT)
def test_arf(self): ct = get_report_format_id_from_string('arf') self.assertEqual(ct, ReportFormatType.ARF)
def test_anonymous_pdf(self): ct = get_report_format_id_from_string('anonymous xml') self.assertEqual(ct, ReportFormatType.ANONYMOUS_XML)
def test_none_or_empty(self): ct = get_report_format_id_from_string(None) self.assertIsNone(ct) ct = get_report_format_id_from_string('') self.assertIsNone(ct)
def test_invalid(self): with self.assertRaises(InvalidArgument): get_report_format_id_from_string('foo')
def test_xml(self): ct = get_report_format_id_from_string('xml') self.assertEqual(ct, ReportFormatType.XML)
def test_pdf(self): ct = get_report_format_id_from_string('pdf') self.assertEqual(ct, ReportFormatType.PDF)
def test_svg(self): ct = get_report_format_id_from_string('svg') self.assertEqual(ct, ReportFormatType.SVG)
def test_csv_hosts(self): ct = get_report_format_id_from_string('csv hosts') self.assertEqual(ct, ReportFormatType.CSV_HOSTS)
def test_(self): ct = get_report_format_id_from_string('cpe') self.assertEqual(ct, ReportFormatType.CPE)
def test_csv_results(self): ct = get_report_format_id_from_string('csv results') self.assertEqual(ct, ReportFormatType.CSV_RESULTS)