1010from __future__ import absolute_import
1111
1212from unittest import TestCase
13-
13+ from Products . ZenModel . Device import Device
1414from Products .ZenModel .Hardware import Hardware
1515from Products .Zing .fact import device_info_fact , MetadataKeys
1616
17+
1718class DummyDevice (object ):
18- id = "dummy_device"
19- title = "Dummy Device"
19+ id = "test_device"
20+ title = "Test Device"
21+ meta_type = "Device"
22+
23+ def __init__ (self ):
24+ self .__class__ = Device
2025
26+ def titleOrId (self ): return self .title
2127 def _propertyMap (self ): return []
2228 def device (self ): return None
2329 def getProductionState (self ): return 1000
@@ -31,17 +37,18 @@ def getHWTag(self): return "device_hw_tag"
3137 def getHWSerialNumber (self ): return "device_hw_sn"
3238
3339
34- class DummyHardwareComponent (Hardware ):
35- id = "dummy_hw_comp"
36- title = "Dummy HW Component"
40+ class DummyHardwareComponent (object ):
41+ id = "test_hw_comp"
42+ title = "Test HW Comp"
43+ meta_type = "HWComponent"
3744
3845 tag = "comp_hw_tag"
3946 serialNumber = "comp_hw_sn"
4047
4148 def __init__ (self ):
42- # Prevent calling MEProduct.__init__ which relies on ZODB infrastructure
43- pass
49+ self .__class__ = Hardware
4450
51+ def titleOrId (self ): return self .title
4552 def _propertyMap (self ): return []
4653 def device (self ): return None
4754 def getProductionState (self ): return 1000
@@ -50,10 +57,8 @@ def getProdStateConversions(self): return {}
5057 def convertProdState (self , state ): return "Production"
5158
5259 def getOSProductKey (self ): return ("os_model" , "os_manufacturer" )
53-
54- # Its own hardware properties
5560 def getProductKey (self ): return ("comp_hw_model" , "comp_hw_manufacturer" )
56-
61+
5762 # Inherited device properties (fallback)
5863 def getHWProductKey (self ): return ("device_hw_model" , "device_hw_manufacturer" )
5964 def getHWTag (self ): return "device_hw_tag"
0 commit comments