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