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_delete_with_type(self):
        self.gmp.delete_report_format(ReportFormatType.SVG)

        report_format_id = get_report_format_id_from_string('svg').value
        self.connection.send.has_been_called_with(
            '<delete_report_format '
            'report_format_id="{}" ultimate="0"/>'.format(report_format_id))
示例#3
0
    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_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))
示例#6
0
    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_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))
示例#8
0
 def test_invalid(self):
     with self.assertRaises(InvalidArgument):
         get_report_format_id_from_string('foo')
示例#9
0
 def test_xml(self):
     ct = get_report_format_id_from_string('xml')
     self.assertEqual(ct, ReportFormatType.XML)
示例#10
0
 def test_svg(self):
     ct = get_report_format_id_from_string('svg')
     self.assertEqual(ct, ReportFormatType.SVG)
示例#11
0
 def test_txt(self):
     ct = get_report_format_id_from_string('txt')
     self.assertEqual(ct, ReportFormatType.TXT)
示例#12
0
 def test_nbe(self):
     ct = get_report_format_id_from_string('nbe')
     self.assertEqual(ct, ReportFormatType.NBE)
示例#13
0
 def test_pdf(self):
     ct = get_report_format_id_from_string('pdf')
     self.assertEqual(ct, ReportFormatType.PDF)
示例#14
0
 def test_itg(self):
     ct = get_report_format_id_from_string('itg')
     self.assertEqual(ct, ReportFormatType.ITG)
示例#15
0
 def test_arf(self):
     ct = get_report_format_id_from_string('arf')
     self.assertEqual(ct, ReportFormatType.ARF)
示例#16
0
 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)
示例#17
0
 def test_gxcr_pdf(self):
     ct = get_report_format_id_from_string('gxcr pdf')
     self.assertEqual(ct, ReportFormatType.GXCR_PDF)
示例#18
0
 def test_csv_results(self):
     ct = get_report_format_id_from_string('csv results')
     self.assertEqual(ct, ReportFormatType.CSV_RESULTS)
示例#19
0
 def test_csv_hosts(self):
     ct = get_report_format_id_from_string('csv hosts')
     self.assertEqual(ct, ReportFormatType.CSV_HOSTS)
示例#20
0
 def test_(self):
     ct = get_report_format_id_from_string('cpe')
     self.assertEqual(ct, ReportFormatType.CPE)
示例#21
0
 def test_verinice_itg(self):
     ct = get_report_format_id_from_string('verinice itg')
     self.assertEqual(ct, ReportFormatType.VERINICE_ITG)
示例#22
0
 def test_latex(self):
     ct = get_report_format_id_from_string('latex')
     self.assertEqual(ct, ReportFormatType.LATEX)
示例#23
0
 def test_gsr_html(self):
     ct = get_report_format_id_from_string('gsr html')
     self.assertEqual(ct, ReportFormatType.GSR_HTML)
示例#24
0
 def test_anonymous_pdf(self):
     ct = get_report_format_id_from_string('anonymous xml')
     self.assertEqual(ct, ReportFormatType.ANONYMOUS_XML)