Exemple #1
0
 def setUp(self):
     self.plugin = Services()
     self.results = Mock()
     self.results.get.return_value = [StringAttributeObject()]
     self.device = StringAttributeObject()
     self.device.zWinServicesNotModeled = []
     self.device.zWinServicesModeled = []
Exemple #2
0
 def test_process(self):
     results = Mock(get=lambda *_: [StringAttributeObject()])
     data = self.plugin.process(StringAttributeObject(), results, Mock())
     self.assertEquals(len(data.maps), 1)
     self.assertEquals(data.maps[0].iis_version, 6)
     self.assertEquals(data.maps[0].sitename, "ServerComment")
     self.assertEquals(data.maps[0].status, "Running")
     self.assertEquals(data.maps[0].statusname, "Name")
     self.assertEquals(data.maps[0].title, "ServerComment")
Exemple #3
0
    def test_filter_maps(self):
        om0 = StringAttributeObject()
        om1 = StringAttributeObject()
        om2 = StringAttributeObject()

        device = StringAttributeObject()
        for objectmap, attribute, prop in zip(
            (om0, om1, om2), ('description', 'interfaceName', 'type'),
            ('zInterfaceMapIgnoreDescriptions', 'zInterfaceMapIgnoreNames',
             'zInterfaceMapIgnoreTypes')):
            setattr(objectmap, attribute, 'ignore')
            setattr(device, prop, 'ignore')

        self.assertFalse(list(filter_maps([om0, om1, om2], device, Mock())))
Exemple #4
0
 def setUp(self):
     self.plugin = OperatingSystem()
     self.device = StringAttributeObject()
     acc = ItemsAccumulator()
     acc.new_item()
     self.results = {'Win32_SystemEnclosure': acc.items,
                     'Win32_ComputerSystem': acc.items,
                     'Win32_OperatingSystem': acc.items,
                     'exchange_version': Mock(stdout=['15'])}
 def testZPS1279(self):
     data = self.plugin.process(StringAttributeObject(), self.results, Mock())
     self.assertEquals(len(data.maps), 2)
     self.assertEquals(data.maps[0].serialNumber, '')
     self.assertEquals(data.maps[0].id, 'SCSI_DISK_VEN_VMWARE_PROD_VIRTUAL_DISK_4_3B5019BE_0_000000')
     self.assertEquals(data.maps[0].partitions, 2)
     self.assertEquals(data.maps[0].disk_ids, ['\\\\.\\PHYSICALDRIVE0',
                                               'SCSI\\DISK&VEN_VMWARE&PROD_VIRTUAL_DISK\\4&3B5019BE&0&000000'])
     self.assertEquals(data.maps[1].size, 0)
Exemple #6
0
 def setUp(self):
     self.plugin = WinCluster()
     self.device = StringAttributeObject()
     self.results = StringAttributeObject()
     self.results['domain'] = 'domain0'
     self.results['nodes'] = ['node0', 'node1']
     self.results['nodes_data'] = ['node0|1|1|2|state0']
     self.results['clusterdisk'] = [
         '2beb|disk1|Vol{2beb}|node0|1|1|2147199|1937045|Online|service',
         'b10c641b-29df-4aff-ab26-53769e793770|CSV Disk|C:\ClusterStorage\Volume1|node0|2|1|2147199||Online|Cluster Shared Volume',
     ]
     self.results['clusternetworks'] = [
         'e4a2|Network1||Up|3', '====',
         'cffc|node0-Ethernet|node0|Network1|127.0.0.1|Intel(R)|Up'
     ]
     self.results['resources'] = [
         "title0|coregroup0|node0|state0|description0|id0|priority0",
         "====", "title0|title0|state0|description0|"
     ]
Exemple #7
0
    def setUp(self):
        self.plugin = Routes()
        self.device = StringAttributeObject()

        result = StringAttributeObject()
        result.Mask = '255.255.255.0'
        result.Protocol = 2
        result.Type = 4

        self.results = StringAttributeObject()
        self.results.Win32_IP4RouteTable = [result]
Exemple #8
0
 def setUp(self):
     self.plugin = OperatingSystem()
     self.device = StringAttributeObject()
     self.results = StringAttributeObject()
     self.results.MSCluster = ()
     self.results.Win32_SystemEnclosure = [StringAttributeObject()]
     self.results.Win32_ComputerSystem = [StringAttributeObject({'blah': 'blah'})]
     self.results.Win32_OperatingSystem = [StringAttributeObject()]
     self.results.exchange_version = Mock(stdout=['15'])
     self.results.ActiveDirectory = [StringAttributeObject()]
     for k in ('TotalVisibleMemorySize', 'TotalVirtualMemorySize'):
         setattr(self.results.Win32_OperatingSystem[0], k, 1)
Exemple #9
0
    def setUp(self):
        self.plugin = Software()
        self.results = dict(software=Mock(stdout=['DisplayName=;InstallDate=;Vendor=|',
                                                  'DisplayName=?????????? Microsoft Report Viewer ??? Visual Studio 2013;'
                                                  'InstallDate=20150710;Vendor=Microsoft Corporation |',
                                                  'DisplayName=Visual Studio 2013? Microsoft Report Viewer ?? ??;'
                                                  'InstallDate=20150710;Vendor=Microsoft Corporation |',
                                                  'DisplayName=Soft x86 - 1.0.0;'
                                                  'InstallDate=19700101;'
                                                  'Vendor=Sunway Systems|',
                                                  'DisplayName=Soft x86 - 1.0.0;'
                                                  'InstallDate=19700101;'
                                                  'Vendor=Вендор|',
                                                  'DisplayName=;xxx;yyy|',
                                                  'DisplayName=Software;InstallDate=;Vendor=SoftCorp'
                                                  ]))

        self.device = StringAttributeObject()
Exemple #10
0
 def test_process(self):
     results = Mock(get=lambda *_: [DiskObject1(), DiskObject2()])
     data = self.plugin.process(StringAttributeObject(), results, Mock())
     self.assertEquals(len(data.maps), 4)
     d3 = data.maps[3]
     self.assertEquals(d3.blockSize, 100)
     self.assertEquals(d3.maxNameLen, 100)
     self.assertEquals(d3.drivetype, 'network drive')
     self.assertEquals(d3.mediatype, 'Fixed hard disk media')
     self.assertEquals(
         d3.mount, 'Name (Serial Number: VolumeSerialNumber) - VolumeName')
     self.assertEquals(d3.perfmonInstance, '\\LogicalDisk(Name)')
     self.assertEquals(d3.storageDevice, 'Name')
     self.assertEquals(
         d3.title, 'Name (Serial Number: VolumeSerialNumber) - VolumeName')
     self.assertEquals(d3.totalBlocks, 1)
     self.assertEquals(d3.totalFiles, 0)
     self.assertEquals(d3.type, 'FileSystem')
Exemple #11
0
 def setUp(self):
     self.plugin = OperatingSystem()
     self.device = StringAttributeObject()
     self.results = load_pickle_file(self, 'OperatingSystem_process_103136')[0]
Exemple #12
0
 def setUp(self):
     self.plugin = OperatingSystem()
     self.device = StringAttributeObject()
Exemple #13
0
 def setUp(self):
     self.plugin = WinMSSQL()
     self.device = StringAttributeObject()
Exemple #14
0
 def test_win32_mapped_logicaldisk_mount(self):
     self.assertEquals(
         win32_mapped_logicaldisk_mount(StringAttributeObject()),
         "Name (Serial Number: VolumeSerialNumber) - VolumeName")
Exemple #15
0
 def test_Win32_volume_mount(self):
     self.assertEquals(Win32_volume_mount(StringAttributeObject()),
                       "Name (Serial Number: SerialNumber) - Label")