コード例 #1
0
    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))
コード例 #2
0
    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))
コード例 #4
0
    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))
コード例 #5
0
    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))
コード例 #7
0
    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)