Ejemplo n.º 1
0
    def test_add_to_element_on_uncommited_rule(mocker):
        import Panorama
        args = {
            'rulename': 'TestRule',
            'element_to_change': 'source',
            'element_value': '2.3.4.5',
            'behaviour': 'add',
        }
        uncommited_rule_item = {
            'response': {
                '@status': 'success',
                '@code': '19',
                'result': {
                    '@total-count': '1',
                    '@count': '1',
                    'source': {
                        '@admin': 'admin',
                        '@dirtyId': '1616',
                        '@time': '2021/11/27 10:55:18',
                        'member': {
                            '@admin': 'admin',
                            '@dirtyId': '1616',
                            '@time': '2021/11/27 10:55:18',
                            '#text': '3.3.3.3',
                        }
                    }
                }
            }
        }
        mocker.patch('Panorama.http_request',
                     return_value=uncommited_rule_item)

        with pytest.raises(DemistoException):
            Panorama.panorama_edit_rule_command(args)
Ejemplo n.º 2
0
 def test_sanity(mocker):
     import Panorama
     args = {
         'rulename': 'TestRule',
         'element_to_change': 'source',
         'element_value': '2.3.4.5,3.3.3.3',
         'behaviour': 'add',
     }
     commited_rule_item = {
         'response': {
             '@status': 'success',
             '@code': '19',
             'result': {
                 '@total-count': '1',
                 '@count': '1',
                 'source': {
                     'member': ['1.1.1.1', '3.3.3.3', '2.3.4.5'],
                 }
             }
         }
     }
     mocker.patch('Panorama.http_request', return_value=commited_rule_item)
     Panorama.panorama_edit_rule_command(args)
Ejemplo n.º 3
0
    def on_bt_panorama_clicked(self):

        imgs = []

        for i in self.image_list_filename:
            temp = cv2.imread(i)
            temp = imutils.resize(temp, width=400, height=400)
            imgs.append(temp)

        if len(imgs) != 0:
            result = pn.stitch(imgs)
            result = imutils.resize(result, width=800, height=800)
            cv2.imshow("Panorama", result)

        else:
            QMessageBox.about(self, 'Panorama', "Không tìm thấy file ảnh!")
Ejemplo n.º 4
0
 def test_without_specify(self, requests_mock):
     import Panorama
     with open('test_data/devices_list.xml', 'r') as data_file:
         requests_mock.get(Panorama.URL, text=data_file.read())
     Panorama.VSYS = None  # this a Panorama instance
     assert list(Panorama.devices()) == [('target1', 'vsys1'), ('target1', 'vsys2'), ('target2', None)]
Ejemplo n.º 5
0
 def test_with_specific_target_and_vsys(self):
     import Panorama
     Panorama.VSYS = None  # this a Panorama instance
     assert list(Panorama.devices(targets=['target'], vsys_s=['vsys1', 'vsys2'])) == [('target', 'vsys1'),
                                                                                      ('target', 'vsys2')]
Ejemplo n.º 6
0
 def test_with_fw(self):
     import Panorama
     Panorama.VSYS = 'this is a FW instance'
     assert list(Panorama.devices()) == [(None, None)]