Merge lp:~adeuring/launchpad/hwdb-build-udev-device-list-2 into lp:launchpad

Proposed by Abel Deuring
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~adeuring/launchpad/hwdb-build-udev-device-list-2
Merge into: lp:launchpad
Diff against target: 1064 lines
2 files modified
lib/canonical/launchpad/scripts/hwdbsubmissions.py (+69/-8)
lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py (+208/-159)
To merge this branch: bzr merge lp:~adeuring/launchpad/hwdb-build-udev-device-list-2
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+13695@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

This branch renames the method SubmissionParser.buildDeviceList() to SubmissionParser.buildHalDeviceList(), and it adds a new method SubmissionParser.buildDeviceList(), which calls buildHalDeviceList() and buildUdevDeviceList().

HWDB Submissions coming from the clinet in Karmic do no longer contain data gathered by HAL; instead, the contain udev data.

The udev data looks quite different and is thus processed differently. Single devices found in submissions with HAL data are represented by instances of class HalDevice, while devices from submissions with udev data are represented by instances of class UdevDevice.

One step in the proeccsing of a HWDB submission is the creation of instances of HalDevice/Udevdevice, which is done in the methods buildHalDeviceList() and buildUdevDeviceList(), respectively.

Depending on the type of the submission, the "right" method from these two should be called, which is done in buildDeviceList().

SuubmissionParser.buildDveiceList makes the implicit assumption that parsed_data['hardware'] has either an item ith the key 'hal' or an item with the key 'udev' (needed in buldUdevDeviceList()), but not both. This is guaranteed by an earlier stage of submission processing.

A second change is mostly mechanical, but causes half of all diff lines: I renames the property SubmissisonParser.hal_devices to SubmissionParser.devices, so that it fits a bit better for submissions containg udev data.

The interesting part of the diff are the first 100 line and the last 20 lines; the remaining part of the diff just reflects the name change SubmissisonParser.hal_devices -> SubmissionParser.devices; I also changed the calls of parser.buildDeviceList() to parser.buildHalDeviceList() in those tests that are specific for HAL data.

Revision history for this message
Abel Deuring (adeuring) wrote :

test: ./bin/test --test=test_hwdb_submission_processing

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/scripts/hwdbsubmissions.py
  lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py

== Pyflakes notices ==

lib/canonical/launchpad/scripts/hwdbsubmissions.py
    22: redefinition of unused 'etree' from line 20

== Pylint notices ==

lib/canonical/launchpad/scripts/hwdbsubmissions.py
    20: [F0401] Unable to import 'xml.etree.cElementTree' (No module named etree)

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Looks fine. I appreciate the courage it takes to defy review limits for the cleanup.

We discussed a few superficialities on IRC. I'll trust your judgment on which tests should test the hal devices and which should test all devices. Beyond that, it looks solid to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
=== modified file 'lib/canonical/launchpad/scripts/hwdbsubmissions.py'
--- lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-10-20 13:33:14 +0000
+++ lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-10-21 10:10:35 +0000
@@ -1397,15 +1397,75 @@
13971397
1398 def buildDeviceList(self, parsed_data):1398 def buildDeviceList(self, parsed_data):
1399 """Create a list of devices from a submission."""1399 """Create a list of devices from a submission."""
1400 self.hal_devices = hal_devices = {}1400 if 'hal' in parsed_data['hardware']:
1401 return self.buildHalDeviceList(parsed_data)
1402 else:
1403 return self.buildUdevDeviceList(parsed_data)
1404
1405 def buildHalDeviceList(self, parsed_data):
1406 """Create a list of devices from the HAL data of a submission."""
1407 self.devices = {}
1401 for hal_data in parsed_data['hardware']['hal']['devices']:1408 for hal_data in parsed_data['hardware']['hal']['devices']:
1402 udi = hal_data['udi']1409 udi = hal_data['udi']
1403 hal_devices[udi] = HALDevice(hal_data['id'], udi,1410 self.devices[udi] = HALDevice(hal_data['id'], udi,
1404 hal_data['properties'], self)1411 hal_data['properties'], self)
1405 for device in hal_devices.values():1412 for device in self.devices.values():
1406 parent_udi = device.parent_udi1413 parent_udi = device.parent_udi
1407 if parent_udi is not None:1414 if parent_udi is not None:
1408 hal_devices[parent_udi].addChild(device)1415 self.devices[parent_udi].addChild(device)
1416 return True
1417
1418 def buildUdevDeviceList(self, parsed_data):
1419 """Create a list of devices from the udev data of a submission."""
1420 self.devices = {}
1421 sysfs_data = parsed_data['hardware']['sysfs-attributes']
1422 dmi_data = parsed_data['hardware']['dmi']
1423 for udev_data in parsed_data['hardware']['udev']:
1424 device_path = udev_data['P']
1425 if device_path == UDEV_ROOT_PATH:
1426 device = UdevDevice(
1427 self, udev_data, sysfs_data=sysfs_data.get(device_path),
1428 dmi_data=dmi_data)
1429 else:
1430 device = UdevDevice(
1431 self, udev_data, sysfs_data=sysfs_data.get(device_path))
1432 self.devices[device_path] = device
1433
1434 # The parent-child relations are derived from the path names of
1435 # the devices. If A and B are the path names of two devices,
1436 # the device with path name A is an ancestor of the device with
1437 # path name B, iff B.startswith(A). If C is the set of the path
1438 # names of all ancestors of A, the element with the longest path
1439 # name belongs to the parent of A.
1440 #
1441 # There is one exception to this rule: The root node has the
1442 # the path name '/devices/LNXSYSTM:00', while the path names
1443 # of PCI devices start with '/devices/pci'. We'll temporarily
1444 # change the path name of the root device so that the rule
1445 # holds for all devices.
1446 if UDEV_ROOT_PATH not in self.devices:
1447 self._logError('No udev root device defined', self.submission_key)
1448 return False
1449 self.devices['/devices'] = self.devices[UDEV_ROOT_PATH]
1450 del self.devices[UDEV_ROOT_PATH]
1451
1452 path_names = sorted(self.devices, key=len, reverse=True)
1453 for path_index, path_name in enumerate(path_names[:-1]):
1454 # Ensure that the last ancestor of each device is our
1455 # root node.
1456 if not path_name.startswith('/devices'):
1457 self._logError(
1458 'Invalid device path name: %r' % path_name,
1459 self.submission_key)
1460 return False
1461 for parent_path in path_names[path_index+1:]:
1462 if path_name.startswith(parent_path):
1463 self.devices[parent_path].addChild(
1464 self.devices[path_name])
1465 break
1466 self.devices[UDEV_ROOT_PATH] = self.devices['/devices']
1467 del self.devices['/devices']
1468 return True
14091469
1410 def buildUdevDeviceList(self, parsed_data):1470 def buildUdevDeviceList(self, parsed_data):
1411 """Create a list of devices from the udev data of a submission."""1471 """Create a list of devices from the udev data of a submission."""
@@ -1460,7 +1520,7 @@
14601520
1461 def getKernelPackageName(self):1521 def getKernelPackageName(self):
1462 """Return the kernel package name of the submission,"""1522 """Return the kernel package name of the submission,"""
1463 root_hal_device = self.hal_devices[ROOT_UDI]1523 root_hal_device = self.devices[ROOT_UDI]
1464 kernel_version = root_hal_device.getProperty('system.kernel.version')1524 kernel_version = root_hal_device.getProperty('system.kernel.version')
1465 if kernel_version is None:1525 if kernel_version is None:
1466 self._logWarning(1526 self._logWarning(
@@ -1521,8 +1581,9 @@
1521 self.parsed_data = parsed_data1581 self.parsed_data = parsed_data
1522 if not self.checkConsistency(parsed_data):1582 if not self.checkConsistency(parsed_data):
1523 return False1583 return False
1524 self.buildDeviceList(parsed_data)1584 if not self.buildDeviceList(parsed_data):
1525 root_device = self.hal_devices[ROOT_UDI]1585 return False
1586 root_device = self.devices[ROOT_UDI]
1526 root_device.createDBData(submission, None)1587 root_device.createDBData(submission, None)
1527 return True1588 return True
15281589
15291590
=== modified file 'lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py'
--- lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-10-20 14:03:44 +0000
+++ lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-10-21 10:10:35 +0000
@@ -136,7 +136,44 @@
136class TestHWDBSubmissionProcessing(TestCaseHWDB):136class TestHWDBSubmissionProcessing(TestCaseHWDB):
137 """Tests for processing of HWDB submissions."""137 """Tests for processing of HWDB submissions."""
138138
139 def testBuildDeviceList(self):139 def test_buildDeviceList(self):
140 """Test of SubmissionParser.buildDeviceList()."""
141 class MockSubmissionParser(SubmissionParser):
142 """A SubmissionParser variant for testing."""
143
144 def __init__(self, hal_result, udev_result):
145 super(MockSubmissionParser, self).__init__()
146 self.hal_result = hal_result
147 self.udev_result = udev_result
148
149 def buildHalDeviceList(self, parsed_data):
150 """See `SubmissionParser`."""
151 return self.hal_result
152
153 def buildUdevDeviceList(self, parsed_data):
154 """See `SubmissionParser`."""
155 return self.udev_result
156
157 parsed_data_hal = {
158 'hardware': {'hal': None}
159 }
160
161 parser = MockSubmissionParser(True, True)
162 self.assertTrue(parser.buildDeviceList(parsed_data_hal))
163
164 parser = MockSubmissionParser(False, True)
165 self.assertFalse(parser.buildDeviceList(parsed_data_hal))
166
167 parsed_data_udev = {
168 'hardware': {'udev': None}
169 }
170 parser = MockSubmissionParser(True, True)
171 self.assertTrue(parser.buildDeviceList(parsed_data_udev))
172
173 parser = MockSubmissionParser(True, False)
174 self.assertFalse(parser.buildDeviceList(parsed_data_udev))
175
176 def test_buildHalDeviceList(self):
140 """Test the creation of list HALDevice instances for a submission."""177 """Test the creation of list HALDevice instances for a submission."""
141 devices = [178 devices = [
142 {179 {
@@ -160,11 +197,11 @@
160 },197 },
161 }198 }
162 parser = SubmissionParser(self.log)199 parser = SubmissionParser(self.log)
163 parser.buildDeviceList(parsed_data)200 parser.buildHalDeviceList(parsed_data)
164 self.assertEqual(len(parser.hal_devices), len(devices),201 self.assertEqual(len(parser.devices), len(devices),
165 'Numbers of devices in parser.hal_devices and in '202 'Numbers of devices in parser.devices and in '
166 'sample data are different')203 'sample data are different')
167 root_device = parser.hal_devices[self.UDI_COMPUTER]204 root_device = parser.devices[self.UDI_COMPUTER]
168 self.assertEqual(root_device.id, 1,205 self.assertEqual(root_device.id, 1,
169 'Unexpected value of root device ID.')206 'Unexpected value of root device ID.')
170 self.assertEqual(root_device.udi, self.UDI_COMPUTER,207 self.assertEqual(root_device.udi, self.UDI_COMPUTER,
@@ -172,7 +209,7 @@
172 self.assertEqual(root_device.properties,209 self.assertEqual(root_device.properties,
173 devices[0]['properties'],210 devices[0]['properties'],
174 'Unexpected properties of root device.')211 'Unexpected properties of root device.')
175 child_device = parser.hal_devices[self.UDI_SATA_CONTROLLER]212 child_device = parser.devices[self.UDI_SATA_CONTROLLER]
176 self.assertEqual(child_device.id, 2,213 self.assertEqual(child_device.id, 2,
177 'Unexpected value of child device ID.')214 'Unexpected value of child device ID.')
178 self.assertEqual(child_device.udi, self.UDI_SATA_CONTROLLER,215 self.assertEqual(child_device.udi, self.UDI_SATA_CONTROLLER,
@@ -181,8 +218,8 @@
181 devices[1]['properties'],218 devices[1]['properties'],
182 'Unexpected properties of child device.')219 'Unexpected properties of child device.')
183220
184 parent = parser.hal_devices[self.UDI_COMPUTER]221 parent = parser.devices[self.UDI_COMPUTER]
185 child = parser.hal_devices[self.UDI_SATA_CONTROLLER]222 child = parser.devices[self.UDI_SATA_CONTROLLER]
186 self.assertEqual(parent.children, [child],223 self.assertEqual(parent.children, [child],
187 'Child missing in parent.children.')224 'Child missing in parent.children.')
188 self.assertEqual(child.parent, parent,225 self.assertEqual(child.parent, parent,
@@ -744,11 +781,10 @@
744 }781 }
745782
746 parser = SubmissionParser()783 parser = SubmissionParser()
747 parser.buildDeviceList(parsed_data)784 parser.buildHalDeviceList(parsed_data)
748785
749 usb_fake_scsi_disk = parser.hal_devices[786 usb_fake_scsi_disk = parser.devices[self.UDI_USB_STORAGE_SCSI_DEVICE]
750 self.UDI_USB_STORAGE_SCSI_DEVICE]787 usb_main_device = parser.devices[self.UDI_USB_STORAGE_IF0]
751 usb_main_device = parser.hal_devices[self.UDI_USB_STORAGE_IF0]
752 self.assertEqual(usb_main_device, usb_fake_scsi_disk.scsi_controller)788 self.assertEqual(usb_main_device, usb_fake_scsi_disk.scsi_controller)
753789
754 def test_HALDevice_scsi_controller_pci_controller(self):790 def test_HALDevice_scsi_controller_pci_controller(self):
@@ -795,10 +831,10 @@
795 }831 }
796832
797 parser = SubmissionParser()833 parser = SubmissionParser()
798 parser.buildDeviceList(parsed_data)834 parser.buildHalDeviceList(parsed_data)
799835
800 scsi_device = parser.hal_devices[self.UDI_SATA_DISK]836 scsi_device = parser.devices[self.UDI_SATA_DISK]
801 controller = parser.hal_devices[self.UDI_SATA_CONTROLLER]837 controller = parser.devices[self.UDI_SATA_CONTROLLER]
802 self.assertEqual(controller, scsi_device.scsi_controller)838 self.assertEqual(controller, scsi_device.scsi_controller)
803839
804 def test_HALDevice_scsi_controller_non_scsi_device(self):840 def test_HALDevice_scsi_controller_non_scsi_device(self):
@@ -822,9 +858,9 @@
822 }858 }
823859
824 parser = SubmissionParser()860 parser = SubmissionParser()
825 parser.buildDeviceList(parsed_data)861 parser.buildHalDeviceList(parsed_data)
826862
827 device = parser.hal_devices[self.UDI_COMPUTER]863 device = parser.devices[self.UDI_COMPUTER]
828 self.assertEqual(None, device.scsi_controller)864 self.assertEqual(None, device.scsi_controller)
829865
830 def test_HALDevice_scsi_controller_no_grandparent(self):866 def test_HALDevice_scsi_controller_no_grandparent(self):
@@ -859,9 +895,9 @@
859895
860 parser = SubmissionParser(self.log)896 parser = SubmissionParser(self.log)
861 parser.submission_key = 'SCSI device without grandparent device'897 parser.submission_key = 'SCSI device without grandparent device'
862 parser.buildDeviceList(parsed_data)898 parser.buildHalDeviceList(parsed_data)
863899
864 scsi_device = parser.hal_devices[self.UDI_SATA_DISK]900 scsi_device = parser.devices[self.UDI_SATA_DISK]
865 self.assertEqual(None, scsi_device.scsi_controller)901 self.assertEqual(None, scsi_device.scsi_controller)
866 self.assertWarningMessage(902 self.assertWarningMessage(
867 parser.submission_key,903 parser.submission_key,
@@ -893,9 +929,9 @@
893929
894 parser = SubmissionParser(self.log)930 parser = SubmissionParser(self.log)
895 parser.submission_key = 'SCSI device without parent device'931 parser.submission_key = 'SCSI device without parent device'
896 parser.buildDeviceList(parsed_data)932 parser.buildHalDeviceList(parsed_data)
897933
898 scsi_device = parser.hal_devices[self.UDI_SATA_DISK]934 scsi_device = parser.devices[self.UDI_SATA_DISK]
899 self.assertEqual(None, scsi_device.scsi_controller)935 self.assertEqual(None, scsi_device.scsi_controller)
900 self.assertWarningMessage(936 self.assertWarningMessage(
901 parser.submission_key,937 parser.submission_key,
@@ -930,8 +966,8 @@
930 },966 },
931 }967 }
932 parser = SubmissionParser(self.log)968 parser = SubmissionParser(self.log)
933 parser.buildDeviceList(parsed_data)969 parser.buildHalDeviceList(parsed_data)
934 test_device = parser.hal_devices[UDI_TEST_DEVICE]970 test_device = parser.devices[UDI_TEST_DEVICE]
935 test_bus = test_device.real_bus971 test_bus = test_device.real_bus
936 self.assertEqual(test_bus, real_bus,972 self.assertEqual(test_bus, real_bus,
937 'Unexpected result of HALDevice.real_bus for '973 'Unexpected result of HALDevice.real_bus for '
@@ -957,8 +993,8 @@
957 },993 },
958 }994 }
959 parser = SubmissionParser(self.log)995 parser = SubmissionParser(self.log)
960 parser.buildDeviceList(parsed_data)996 parser.buildHalDeviceList(parsed_data)
961 test_device = parser.hal_devices[self.UDI_COMPUTER]997 test_device = parser.devices[self.UDI_COMPUTER]
962 test_bus = test_device.real_bus998 test_bus = test_device.real_bus
963 self.assertEqual(test_bus, HWBus.SYSTEM,999 self.assertEqual(test_bus, HWBus.SYSTEM,
964 'Unexpected result of HALDevice.real_bus for '1000 'Unexpected result of HALDevice.real_bus for '
@@ -1017,10 +1053,9 @@
1017 }1053 }
10181054
1019 parser = SubmissionParser(self.log)1055 parser = SubmissionParser(self.log)
1020 parser.buildDeviceList(parsed_data)1056 parser.buildHalDeviceList(parsed_data)
10211057
1022 usb_fake_scsi_disk = parser.hal_devices[1058 usb_fake_scsi_disk = parser.devices[self.UDI_USB_STORAGE_SCSI_DEVICE]
1023 self.UDI_USB_STORAGE_SCSI_DEVICE]
1024 self.assertEqual(usb_fake_scsi_disk.real_bus, None,1059 self.assertEqual(usb_fake_scsi_disk.real_bus, None,
1025 'Unexpected result of HALDevice.real_bus for the fake SCSI '1060 'Unexpected result of HALDevice.real_bus for the fake SCSI '
1026 'disk HAL node of a USB storage device bus.')1061 'disk HAL node of a USB storage device bus.')
@@ -1085,12 +1120,12 @@
1085 )1120 )
10861121
1087 parser = SubmissionParser(self.log)1122 parser = SubmissionParser(self.log)
1088 parser.buildDeviceList(parsed_data)1123 parser.buildHalDeviceList(parsed_data)
10891124
1090 for device_subclass, expected_bus in pci_subclass_bus:1125 for device_subclass, expected_bus in pci_subclass_bus:
1091 devices[0]['properties']['pci.device_subclass'] = (1126 devices[0]['properties']['pci.device_subclass'] = (
1092 device_subclass, 'int')1127 device_subclass, 'int')
1093 fake_scsi_disk = parser.hal_devices[self.UDI_SATA_DISK]1128 fake_scsi_disk = parser.devices[self.UDI_SATA_DISK]
1094 found_bus = fake_scsi_disk.real_bus1129 found_bus = fake_scsi_disk.real_bus
1095 self.assertEqual(found_bus, expected_bus,1130 self.assertEqual(found_bus, expected_bus,
1096 'Unexpected result of HWDevice.real_bus for PCI storage '1131 'Unexpected result of HWDevice.real_bus for PCI storage '
@@ -1125,8 +1160,8 @@
1125 }1160 }
1126 parser = SubmissionParser(self.log)1161 parser = SubmissionParser(self.log)
1127 parser.submission_key = 'Test SCSI disk without a grandparent'1162 parser.submission_key = 'Test SCSI disk without a grandparent'
1128 parser.buildDeviceList(parsed_data)1163 parser.buildHalDeviceList(parsed_data)
1129 scsi_disk = parser.hal_devices[self.UDI_SCSI_DISK]1164 scsi_disk = parser.devices[self.UDI_SCSI_DISK]
1130 bus = scsi_disk.real_bus1165 bus = scsi_disk.real_bus
1131 self.assertEqual(bus, None,1166 self.assertEqual(bus, None,
1132 'Unexpected result of HALDevice.real_bus for a SCSI device '1167 'Unexpected result of HALDevice.real_bus for a SCSI device '
@@ -1155,8 +1190,8 @@
1155 }1190 }
1156 parser = SubmissionParser(self.log)1191 parser = SubmissionParser(self.log)
1157 parser.submission_key = 'Test SCSI disk without a parent'1192 parser.submission_key = 'Test SCSI disk without a parent'
1158 parser.buildDeviceList(parsed_data)1193 parser.buildHalDeviceList(parsed_data)
1159 scsi_disk = parser.hal_devices[self.UDI_SCSI_DISK]1194 scsi_disk = parser.devices[self.UDI_SCSI_DISK]
1160 bus = scsi_disk.real_bus1195 bus = scsi_disk.real_bus
1161 self.assertEqual(bus, None,1196 self.assertEqual(bus, None,
1162 'Unexpected result of HALDevice.real_bus for a SCSI device '1197 'Unexpected result of HALDevice.real_bus for a SCSI device '
@@ -1210,8 +1245,8 @@
1210 parser = SubmissionParser(self.log)1245 parser = SubmissionParser(self.log)
1211 parser.submission_key = (1246 parser.submission_key = (
1212 'Test SCSI disk with invalid controller device class')1247 'Test SCSI disk with invalid controller device class')
1213 parser.buildDeviceList(parsed_data)1248 parser.buildHalDeviceList(parsed_data)
1214 scsi_disk = parser.hal_devices[self.UDI_SATA_DISK]1249 scsi_disk = parser.devices[self.UDI_SATA_DISK]
1215 bus = scsi_disk.real_bus1250 bus = scsi_disk.real_bus
1216 self.assertEqual(bus, None,1251 self.assertEqual(bus, None,
1217 'Unexpected result of HALDevice.real_bus for a SCSI device '1252 'Unexpected result of HALDevice.real_bus for a SCSI device '
@@ -1286,8 +1321,8 @@
1286 parent_device['udi'], 'str')1321 parent_device['udi'], 'str')
1287 devices.append(tested_device)1322 devices.append(tested_device)
1288 parsed_data['hardware']['hal']['devices'] = devices1323 parsed_data['hardware']['hal']['devices'] = devices
1289 parser.buildDeviceList(parsed_data)1324 parser.buildHalDeviceList(parsed_data)
1290 tested_hal_device = parser.hal_devices[self.UDI_PCCARD_DEVICE]1325 tested_hal_device = parser.devices[self.UDI_PCCARD_DEVICE]
1291 found_bus = tested_hal_device.real_bus1326 found_bus = tested_hal_device.real_bus
1292 expected_bus = expected_result_for_parent_device[1327 expected_bus = expected_result_for_parent_device[
1293 parent_device['udi']]1328 parent_device['udi']]
@@ -1317,8 +1352,8 @@
13171352
1318 parser = SubmissionParser(self.log)1353 parser = SubmissionParser(self.log)
1319 parser.submission_key = 'Test of unknown bus name'1354 parser.submission_key = 'Test of unknown bus name'
1320 parser.buildDeviceList(parsed_data)1355 parser.buildHalDeviceList(parsed_data)
1321 found_bus = parser.hal_devices[self.UDI_PCCARD_DEVICE].real_bus1356 found_bus = parser.devices[self.UDI_PCCARD_DEVICE].real_bus
1322 self.assertEqual(found_bus, None,1357 self.assertEqual(found_bus, None,
1323 'Unexpected result of HWDevice.real_bus for an '1358 'Unexpected result of HWDevice.real_bus for an '
1324 'unknown bus name: Expected None, got %r.'1359 'unknown bus name: Expected None, got %r.'
@@ -1346,8 +1381,8 @@
13461381
1347 parser = SubmissionParser()1382 parser = SubmissionParser()
1348 parser.submission_key = 'Test of HALDevice.is_root_device'1383 parser.submission_key = 'Test of HALDevice.is_root_device'
1349 parser.buildDeviceList(parsed_data)1384 parser.buildHalDeviceList(parsed_data)
1350 self.assertTrue(parser.hal_devices[self.UDI_COMPUTER].is_root_device)1385 self.assertTrue(parser.devices[self.UDI_COMPUTER].is_root_device)
13511386
1352 def test_HALDevice_is_root_device_for_non_root_device(self):1387 def test_HALDevice_is_root_device_for_non_root_device(self):
1353 """Test of HALDevice.is_root_device for a non-root device."""1388 """Test of HALDevice.is_root_device for a non-root device."""
@@ -1368,9 +1403,9 @@
13681403
1369 parser = SubmissionParser()1404 parser = SubmissionParser()
1370 parser.submission_key = 'Test of HALDevice.is_root_device'1405 parser.submission_key = 'Test of HALDevice.is_root_device'
1371 parser.buildDeviceList(parsed_data)1406 parser.buildHalDeviceList(parsed_data)
1372 self.assertFalse(1407 self.assertFalse(
1373 parser.hal_devices[self.UDI_PCCARD_DEVICE].is_root_device)1408 parser.devices[self.UDI_PCCARD_DEVICE].is_root_device)
13741409
1375 def renameInfoBusToInfoSubsystem(self, devices):1410 def renameInfoBusToInfoSubsystem(self, devices):
1376 """Rename the property info.bus in a device list to info.subsystem.1411 """Rename the property info.bus in a device list to info.subsystem.
@@ -1418,14 +1453,14 @@
1418 },1453 },
1419 }1454 }
1420 parser = SubmissionParser(self.log)1455 parser = SubmissionParser(self.log)
1421 parser.buildDeviceList(parsed_data)1456 parser.buildHalDeviceList(parsed_data)
1422 device = parser.hal_devices[self.UDI_USB_CONTROLLER_PCI_SIDE]1457 device = parser.devices[self.UDI_USB_CONTROLLER_PCI_SIDE]
1423 self.failUnless(device.is_real_device,1458 self.failUnless(device.is_real_device,
1424 'Device with info.bus property not treated as a '1459 'Device with info.bus property not treated as a '
1425 'real device.')1460 'real device.')
1426 self.renameInfoBusToInfoSubsystem(devices)1461 self.renameInfoBusToInfoSubsystem(devices)
1427 parser.buildDeviceList(parsed_data)1462 parser.buildHalDeviceList(parsed_data)
1428 device = parser.hal_devices[self.UDI_USB_CONTROLLER_PCI_SIDE]1463 device = parser.devices[self.UDI_USB_CONTROLLER_PCI_SIDE]
1429 self.failUnless(device.is_real_device,1464 self.failUnless(device.is_real_device,
1430 'Device with info.subsystem property not treated as '1465 'Device with info.subsystem property not treated as '
1431 'a real device.')1466 'a real device.')
@@ -1449,8 +1484,8 @@
1449 }1484 }
14501485
1451 parser = SubmissionParser(self.log)1486 parser = SubmissionParser(self.log)
1452 parser.buildDeviceList(parsed_data)1487 parser.buildHalDeviceList(parsed_data)
1453 device = parser.hal_devices[UDI_HAL_STORAGE_DEVICE]1488 device = parser.devices[UDI_HAL_STORAGE_DEVICE]
1454 self.failIf(device.is_real_device,1489 self.failIf(device.is_real_device,
1455 'Device without info.bus property treated as a '1490 'Device without info.bus property treated as a '
1456 'real device')1491 'real device')
@@ -1489,8 +1524,8 @@
1489 'sound', 'ssb', 'tty', 'usb', 'video4linux', )1524 'sound', 'ssb', 'tty', 'usb', 'video4linux', )
1490 for tested_bus in ignored_buses:1525 for tested_bus in ignored_buses:
1491 properties['info.bus'] = (tested_bus, 'str')1526 properties['info.bus'] = (tested_bus, 'str')
1492 parser.buildDeviceList(parsed_data)1527 parser.buildHalDeviceList(parsed_data)
1493 device = parser.hal_devices[self.UDI_USB_HUB_IF0]1528 device = parser.devices[self.UDI_USB_HUB_IF0]
1494 self.failIf(1529 self.failIf(
1495 device.is_real_device,1530 device.is_real_device,
1496 'Device with info.bus=%s treated as a real device'1531 'Device with info.bus=%s treated as a real device'
@@ -1499,8 +1534,8 @@
1499 del properties['info.bus']1534 del properties['info.bus']
1500 for tested_bus in ignored_buses:1535 for tested_bus in ignored_buses:
1501 properties['info.subsystem'] = (tested_bus, 'str')1536 properties['info.subsystem'] = (tested_bus, 'str')
1502 parser.buildDeviceList(parsed_data)1537 parser.buildHalDeviceList(parsed_data)
1503 device = parser.hal_devices[self.UDI_USB_HUB_IF0]1538 device = parser.devices[self.UDI_USB_HUB_IF0]
1504 self.failIf(1539 self.failIf(
1505 device.is_real_device,1540 device.is_real_device,
1506 'Device with info.subsystem=%s treated as a real device'1541 'Device with info.subsystem=%s treated as a real device'
@@ -1532,12 +1567,12 @@
1532 )1567 )
15331568
1534 parser = SubmissionParser(self.log)1569 parser = SubmissionParser(self.log)
1535 parser.buildDeviceList(parsed_data)1570 parser.buildHalDeviceList(parsed_data)
15361571
1537 for device_subclass, expected_is_real in pci_subclass_bus:1572 for device_subclass, expected_is_real in pci_subclass_bus:
1538 devices[0]['properties']['pci.device_subclass'] = (1573 devices[0]['properties']['pci.device_subclass'] = (
1539 device_subclass, 'int')1574 device_subclass, 'int')
1540 scsi_device = parser.hal_devices[self.UDI_SATA_DISK]1575 scsi_device = parser.devices[self.UDI_SATA_DISK]
1541 found_is_real = scsi_device.is_real_device1576 found_is_real = scsi_device.is_real_device
1542 self.assertEqual(found_is_real, expected_is_real,1577 self.assertEqual(found_is_real, expected_is_real,
1543 'Unexpected result of HWDevice.is_real_device for a HAL SCSI '1578 'Unexpected result of HWDevice.is_real_device for a HAL SCSI '
@@ -1641,15 +1676,15 @@
1641 }1676 }
16421677
1643 parser = SubmissionParser(self.log)1678 parser = SubmissionParser(self.log)
1644 parser.buildDeviceList(parsed_data)1679 parser.buildHalDeviceList(parsed_data)
16451680
1646 scsi_device = parser.hal_devices[self.UDI_USB_STORAGE_SCSI_DEVICE]1681 scsi_device = parser.devices[self.UDI_USB_STORAGE_SCSI_DEVICE]
1647 self.failIf(scsi_device.is_real_device,1682 self.failIf(scsi_device.is_real_device,
1648 'Unexpected result of HWDevice.is_real_device for a HAL SCSI '1683 'Unexpected result of HWDevice.is_real_device for a HAL SCSI '
1649 'device as a subdevice of a USB storage device.')1684 'device as a subdevice of a USB storage device.')
16501685
1651 self.renameInfoBusToInfoSubsystem(devices)1686 self.renameInfoBusToInfoSubsystem(devices)
1652 scsi_device = parser.hal_devices[self.UDI_USB_STORAGE_SCSI_DEVICE]1687 scsi_device = parser.devices[self.UDI_USB_STORAGE_SCSI_DEVICE]
1653 self.failIf(scsi_device.is_real_device,1688 self.failIf(scsi_device.is_real_device,
1654 'Unexpected result of HWDevice.is_real_device for a HAL SCSI '1689 'Unexpected result of HWDevice.is_real_device for a HAL SCSI '
1655 'device as a subdevice of a USB storage device.')1690 'device as a subdevice of a USB storage device.')
@@ -1672,8 +1707,8 @@
1672 }1707 }
16731708
1674 parser = SubmissionParser(self.log)1709 parser = SubmissionParser(self.log)
1675 parser.buildDeviceList(parsed_data)1710 parser.buildHalDeviceList(parsed_data)
1676 device = parser.hal_devices[self.UDI_COMPUTER]1711 device = parser.devices[self.UDI_COMPUTER]
1677 self.failUnless(device.is_real_device,1712 self.failUnless(device.is_real_device,
1678 'Root device not treated as a real device')1713 'Root device not treated as a real device')
16791714
@@ -1745,11 +1780,11 @@
1745 }1780 }
17461781
1747 parser = SubmissionParser(self.log)1782 parser = SubmissionParser(self.log)
1748 parser.buildDeviceList(parsed_data)1783 parser.buildHalDeviceList(parsed_data)
17491784
1750 # The PCI-USB bridge is a child of the system.1785 # The PCI-USB bridge is a child of the system.
1751 root_device = parser.hal_devices[self.UDI_COMPUTER]1786 root_device = parser.devices[self.UDI_COMPUTER]
1752 pci_usb_bridge = parser.hal_devices[self.UDI_USB_CONTROLLER_PCI_SIDE]1787 pci_usb_bridge = parser.devices[self.UDI_USB_CONTROLLER_PCI_SIDE]
1753 self.assertEqual(root_device.getRealChildren(), [pci_usb_bridge],1788 self.assertEqual(root_device.getRealChildren(), [pci_usb_bridge],
1754 'Unexpected list of real children of the root '1789 'Unexpected list of real children of the root '
1755 'device')1790 'device')
@@ -1759,7 +1794,7 @@
1759 # but the node for the USB device is considered to be a child1794 # but the node for the USB device is considered to be a child
1760 # of the bridge.1795 # of the bridge.
17611796
1762 usb_device = parser.hal_devices[self.UDI_USB_HUB]1797 usb_device = parser.devices[self.UDI_USB_HUB]
1763 self.assertEqual(pci_usb_bridge.getRealChildren(), [usb_device],1798 self.assertEqual(pci_usb_bridge.getRealChildren(), [usb_device],
1764 'Unexpected list of real children of the PCI-> '1799 'Unexpected list of real children of the PCI-> '
1765 'USB bridge')1800 'USB bridge')
@@ -1793,8 +1828,8 @@
1793 },1828 },
1794 }1829 }
1795 parser = SubmissionParser(self.log)1830 parser = SubmissionParser(self.log)
1796 parser.buildDeviceList(parsed_data)1831 parser.buildHalDeviceList(parsed_data)
1797 device = parser.hal_devices[self.UDI_SATA_CONTROLLER]1832 device = parser.devices[self.UDI_SATA_CONTROLLER]
1798 self.failUnless(1833 self.failUnless(
1799 device.has_reliable_data,1834 device.has_reliable_data,
1800 'Regular device treated as not having reliable data.')1835 'Regular device treated as not having reliable data.')
@@ -1821,8 +1856,8 @@
1821 'mmc', 'mmc_host', 'pcmcia', 'platform', 'pnp',1856 'mmc', 'mmc_host', 'pcmcia', 'platform', 'pnp',
1822 'power_supply', 'unknown'):1857 'power_supply', 'unknown'):
1823 properties['info.bus'] = (bus, 'str')1858 properties['info.bus'] = (bus, 'str')
1824 parser.buildDeviceList(parsed_data)1859 parser.buildHalDeviceList(parsed_data)
1825 device = parser.hal_devices[self.UDI_SATA_CONTROLLER]1860 device = parser.devices[self.UDI_SATA_CONTROLLER]
1826 self.failIf(device.has_reliable_data,1861 self.failIf(device.has_reliable_data,
1827 'Device with bus=%s treated as having reliable data.' % bus)1862 'Device with bus=%s treated as having reliable data.' % bus)
18281863
@@ -1853,8 +1888,8 @@
1853 }1888 }
1854 parser = SubmissionParser(self.log)1889 parser = SubmissionParser(self.log)
1855 properties = devices[0]['properties']1890 properties = devices[0]['properties']
1856 parser.buildDeviceList(parsed_data)1891 parser.buildHalDeviceList(parsed_data)
1857 device = parser.hal_devices[self.UDI_COMPUTER]1892 device = parser.devices[self.UDI_COMPUTER]
1858 self.failUnless(device.has_reliable_data,1893 self.failUnless(device.has_reliable_data,
1859 'Root device not treated as having reliable data.')1894 'Root device not treated as having reliable data.')
18601895
@@ -1921,8 +1956,8 @@
1921 parser = SubmissionParser(self.log)1956 parser = SubmissionParser(self.log)
1922 submission_key = 'test_missing_%s' % missing_data1957 submission_key = 'test_missing_%s' % missing_data
1923 parser.submission_key = submission_key1958 parser.submission_key = submission_key
1924 parser.buildDeviceList(test_parsed_data)1959 parser.buildHalDeviceList(test_parsed_data)
1925 device = parser.hal_devices[self.UDI_SATA_CONTROLLER]1960 device = parser.devices[self.UDI_SATA_CONTROLLER]
1926 self.failIf(1961 self.failIf(
1927 device.has_reliable_data,1962 device.has_reliable_data,
1928 'Device with missing property %s treated as having reliable'1963 'Device with missing property %s treated as having reliable'
@@ -1971,8 +2006,8 @@
1971 }2006 }
19722007
1973 parser = SubmissionParser(self.log)2008 parser = SubmissionParser(self.log)
1974 parser.buildDeviceList(parsed_data)2009 parser.buildHalDeviceList(parsed_data)
1975 device = parser.hal_devices[self.UDI_SATA_DISK]2010 device = parser.devices[self.UDI_SATA_DISK]
1976 self.failIf(2011 self.failIf(
1977 device.has_reliable_data,2012 device.has_reliable_data,
1978 'IDE Device with missing properties vendor ID, product ID, '2013 'IDE Device with missing properties vendor ID, product ID, '
@@ -2003,8 +2038,8 @@
2003 },2038 },
2004 }2039 }
2005 parser = SubmissionParser(self.log)2040 parser = SubmissionParser(self.log)
2006 parser.buildDeviceList(parsed_data)2041 parser.buildHalDeviceList(parsed_data)
2007 device = parser.hal_devices[self.UDI_SCSI_DISK]2042 device = parser.devices[self.UDI_SCSI_DISK]
2008 vendor_model = device.getScsiVendorAndModelName()2043 vendor_model = device.getScsiVendorAndModelName()
2009 self.assertEqual(2044 self.assertEqual(
2010 {2045 {
@@ -2042,8 +2077,8 @@
2042 },2077 },
2043 }2078 }
2044 parser = SubmissionParser(self.log)2079 parser = SubmissionParser(self.log)
2045 parser.buildDeviceList(parsed_data)2080 parser.buildHalDeviceList(parsed_data)
2046 device = parser.hal_devices[self.UDI_SCSI_DISK]2081 device = parser.devices[self.UDI_SCSI_DISK]
2047 vendor_model = device.getScsiVendorAndModelName()2082 vendor_model = device.getScsiVendorAndModelName()
2048 self.assertEqual(2083 self.assertEqual(
2049 {2084 {
@@ -2080,8 +2115,8 @@
2080 },2115 },
2081 }2116 }
2082 parser = SubmissionParser(self.log)2117 parser = SubmissionParser(self.log)
2083 parser.buildDeviceList(parsed_data)2118 parser.buildHalDeviceList(parsed_data)
2084 device = parser.hal_devices[self.UDI_SCSI_DISK]2119 device = parser.devices[self.UDI_SCSI_DISK]
2085 vendor_product = device.getScsiVendorAndModelName()2120 vendor_product = device.getScsiVendorAndModelName()
2086 self.assertEqual(2121 self.assertEqual(
2087 {2122 {
@@ -2116,8 +2151,8 @@
2116 },2151 },
2117 }2152 }
2118 parser = SubmissionParser(self.log)2153 parser = SubmissionParser(self.log)
2119 parser.buildDeviceList(parsed_data)2154 parser.buildHalDeviceList(parsed_data)
2120 found_vendor = parser.hal_devices[self.UDI_SATA_CONTROLLER].vendor2155 found_vendor = parser.devices[self.UDI_SATA_CONTROLLER].vendor
2121 self.assertEqual(found_vendor, 'Intel Corporation',2156 self.assertEqual(found_vendor, 'Intel Corporation',
2122 'Unexpected result of HWDevice.vendor. '2157 'Unexpected result of HWDevice.vendor. '
2123 'Expected Intel Corporation, got %r.'2158 'Expected Intel Corporation, got %r.'
@@ -2147,8 +2182,8 @@
2147 },2182 },
2148 }2183 }
2149 parser = SubmissionParser(self.log)2184 parser = SubmissionParser(self.log)
2150 parser.buildDeviceList(parsed_data)2185 parser.buildHalDeviceList(parsed_data)
2151 found_vendor = parser.hal_devices[self.UDI_SATA_CONTROLLER].vendor2186 found_vendor = parser.devices[self.UDI_SATA_CONTROLLER].vendor
2152 self.assertEqual(found_vendor, 'Intel Corporation',2187 self.assertEqual(found_vendor, 'Intel Corporation',
2153 'Unexpected result of HWDevice.vendor, '2188 'Unexpected result of HWDevice.vendor, '
2154 'if info.vendor does not exist. '2189 'if info.vendor does not exist. '
@@ -2175,8 +2210,8 @@
2175 },2210 },
2176 }2211 }
2177 parser = SubmissionParser(self.log)2212 parser = SubmissionParser(self.log)
2178 parser.buildDeviceList(parsed_data)2213 parser.buildHalDeviceList(parsed_data)
2179 found_vendor = parser.hal_devices[self.UDI_SCSI_DISK].vendor2214 found_vendor = parser.devices[self.UDI_SCSI_DISK].vendor
2180 self.assertEqual(found_vendor, 'SEAGATE',2215 self.assertEqual(found_vendor, 'SEAGATE',
2181 'Unexpected result of HWDevice.vendor '2216 'Unexpected result of HWDevice.vendor '
2182 'for SCSI device. Expected SEAGATE, got %r.'2217 'for SCSI device. Expected SEAGATE, got %r.'
@@ -2203,8 +2238,8 @@
2203 },2238 },
2204 }2239 }
2205 parser = SubmissionParser(self.log)2240 parser = SubmissionParser(self.log)
2206 parser.buildDeviceList(parsed_data)2241 parser.buildHalDeviceList(parsed_data)
2207 found_vendor = parser.hal_devices[self.UDI_SCSI_DISK].vendor2242 found_vendor = parser.devices[self.UDI_SCSI_DISK].vendor
2208 self.assertEqual(found_vendor, 'Hitachi',2243 self.assertEqual(found_vendor, 'Hitachi',
2209 'Unexpected result of HWDevice.vendor, for fake '2244 'Unexpected result of HWDevice.vendor, for fake '
2210 'SCSI device. Expected Hitachi, got %r.'2245 'SCSI device. Expected Hitachi, got %r.'
@@ -2233,8 +2268,8 @@
2233 },2268 },
2234 }2269 }
2235 parser = SubmissionParser(self.log)2270 parser = SubmissionParser(self.log)
2236 parser.buildDeviceList(parsed_data)2271 parser.buildHalDeviceList(parsed_data)
2237 found_vendor = parser.hal_devices[self.UDI_COMPUTER].vendor2272 found_vendor = parser.devices[self.UDI_COMPUTER].vendor
2238 self.assertEqual(found_vendor, 'FUJITSU SIEMENS',2273 self.assertEqual(found_vendor, 'FUJITSU SIEMENS',
2239 'Unexpected result of HWDevice.vendor for a '2274 'Unexpected result of HWDevice.vendor for a '
2240 'system. Expected FUJITSU SIEMENS, got %r.'2275 'system. Expected FUJITSU SIEMENS, got %r.'
@@ -2266,8 +2301,8 @@
2266 },2301 },
2267 }2302 }
2268 parser = SubmissionParser(self.log)2303 parser = SubmissionParser(self.log)
2269 parser.buildDeviceList(parsed_data)2304 parser.buildHalDeviceList(parsed_data)
2270 found_product = parser.hal_devices[self.UDI_SATA_CONTROLLER].product2305 found_product = parser.devices[self.UDI_SATA_CONTROLLER].product
2271 self.assertEqual(found_product, '82801GBM/GHM SATA AHCI Controller',2306 self.assertEqual(found_product, '82801GBM/GHM SATA AHCI Controller',
2272 'Unexpected result of HWDevice.product. '2307 'Unexpected result of HWDevice.product. '
2273 'Expected 82801GBM/GHM SATA AHCI Controller, got %r.'2308 'Expected 82801GBM/GHM SATA AHCI Controller, got %r.'
@@ -2297,8 +2332,8 @@
2297 },2332 },
2298 }2333 }
2299 parser = SubmissionParser(self.log)2334 parser = SubmissionParser(self.log)
2300 parser.buildDeviceList(parsed_data)2335 parser.buildHalDeviceList(parsed_data)
2301 found_product = parser.hal_devices[self.UDI_SATA_CONTROLLER].product2336 found_product = parser.devices[self.UDI_SATA_CONTROLLER].product
2302 self.assertEqual(found_product, '82801GBM/GHM SATA AHCI Controller',2337 self.assertEqual(found_product, '82801GBM/GHM SATA AHCI Controller',
2303 'Unexpected result of HWDevice.product, '2338 'Unexpected result of HWDevice.product, '
2304 'if info.product does not exist. '2339 'if info.product does not exist. '
@@ -2327,8 +2362,8 @@
2327 },2362 },
2328 }2363 }
2329 parser = SubmissionParser(self.log)2364 parser = SubmissionParser(self.log)
2330 parser.buildDeviceList(parsed_data)2365 parser.buildHalDeviceList(parsed_data)
2331 found_product = parser.hal_devices[self.UDI_SCSI_DISK].product2366 found_product = parser.devices[self.UDI_SCSI_DISK].product
2332 self.assertEqual(found_product, 'ST36530N',2367 self.assertEqual(found_product, 'ST36530N',
2333 'Unexpected result of HWDevice.product '2368 'Unexpected result of HWDevice.product '
2334 'for SCSI device. Expected ST36530N, got %r.'2369 'for SCSI device. Expected ST36530N, got %r.'
@@ -2355,8 +2390,8 @@
2355 },2390 },
2356 }2391 }
2357 parser = SubmissionParser(self.log)2392 parser = SubmissionParser(self.log)
2358 parser.buildDeviceList(parsed_data)2393 parser.buildHalDeviceList(parsed_data)
2359 found_product = parser.hal_devices[self.UDI_SCSI_DISK].product2394 found_product = parser.devices[self.UDI_SCSI_DISK].product
2360 self.assertEqual(found_product, 'HTS54161',2395 self.assertEqual(found_product, 'HTS54161',
2361 'Unexpected result of HWDevice.product, for fake '2396 'Unexpected result of HWDevice.product, for fake '
2362 'SCSI device. Expected HTS54161, got %r.'2397 'SCSI device. Expected HTS54161, got %r.'
@@ -2385,8 +2420,8 @@
2385 },2420 },
2386 }2421 }
2387 parser = SubmissionParser(self.log)2422 parser = SubmissionParser(self.log)
2388 parser.buildDeviceList(parsed_data)2423 parser.buildHalDeviceList(parsed_data)
2389 found_product = parser.hal_devices[self.UDI_COMPUTER].product2424 found_product = parser.devices[self.UDI_COMPUTER].product
2390 self.assertEqual(found_product, 'LIFEBOOK E8210',2425 self.assertEqual(found_product, 'LIFEBOOK E8210',
2391 'Unexpected result of HWDevice.product, '2426 'Unexpected result of HWDevice.product, '
2392 'if info.product does not exist. '2427 'if info.product does not exist. '
@@ -2418,8 +2453,8 @@
2418 },2453 },
2419 }2454 }
2420 parser = SubmissionParser(self.log)2455 parser = SubmissionParser(self.log)
2421 parser.buildDeviceList(parsed_data)2456 parser.buildHalDeviceList(parsed_data)
2422 found_vendor_id = parser.hal_devices[2457 found_vendor_id = parser.devices[
2423 self.UDI_SATA_CONTROLLER].vendor_id2458 self.UDI_SATA_CONTROLLER].vendor_id
2424 self.assertEqual(found_vendor_id, self.PCI_VENDOR_ID_INTEL,2459 self.assertEqual(found_vendor_id, self.PCI_VENDOR_ID_INTEL,
2425 'Unexpected result of HWDevice.vendor_id. '2460 'Unexpected result of HWDevice.vendor_id. '
@@ -2451,8 +2486,8 @@
2451 },2486 },
2452 }2487 }
2453 parser = SubmissionParser(self.log)2488 parser = SubmissionParser(self.log)
2454 parser.buildDeviceList(parsed_data)2489 parser.buildHalDeviceList(parsed_data)
2455 found_vendor_id = parser.hal_devices[self.UDI_SCSI_DISK].vendor_id2490 found_vendor_id = parser.devices[self.UDI_SCSI_DISK].vendor_id
2456 self.assertEqual(found_vendor_id, 'SEAGATE',2491 self.assertEqual(found_vendor_id, 'SEAGATE',
2457 'Unexpected result of HWDevice.vendor_id for a. '2492 'Unexpected result of HWDevice.vendor_id for a. '
2458 'SCSI device. Expected SEAGATE, got %r.'2493 'SCSI device. Expected SEAGATE, got %r.'
@@ -2480,8 +2515,8 @@
2480 },2515 },
2481 }2516 }
2482 parser = SubmissionParser(self.log)2517 parser = SubmissionParser(self.log)
2483 parser.buildDeviceList(parsed_data)2518 parser.buildHalDeviceList(parsed_data)
2484 found_vendor_id = parser.hal_devices[self.UDI_SCSI_DISK].vendor_id2519 found_vendor_id = parser.devices[self.UDI_SCSI_DISK].vendor_id
2485 self.assertEqual(found_vendor_id, 'Hitachi',2520 self.assertEqual(found_vendor_id, 'Hitachi',
2486 'Unexpected result of HWDevice.vendor_id for a. '2521 'Unexpected result of HWDevice.vendor_id for a. '
2487 'fake SCSI device. Expected Hitachi, got %r.'2522 'fake SCSI device. Expected Hitachi, got %r.'
@@ -2510,8 +2545,8 @@
2510 },2545 },
2511 }2546 }
2512 parser = SubmissionParser(self.log)2547 parser = SubmissionParser(self.log)
2513 parser.buildDeviceList(parsed_data)2548 parser.buildHalDeviceList(parsed_data)
2514 found_vendor_id = parser.hal_devices[self.UDI_COMPUTER].vendor_id2549 found_vendor_id = parser.devices[self.UDI_COMPUTER].vendor_id
2515 self.assertEqual(found_vendor_id, 'FUJITSU SIEMENS',2550 self.assertEqual(found_vendor_id, 'FUJITSU SIEMENS',
2516 'Unexpected result of HWDevice.vendor_id for a '2551 'Unexpected result of HWDevice.vendor_id for a '
2517 'system. Expected FUJITSU SIEMENS, got %r.'2552 'system. Expected FUJITSU SIEMENS, got %r.'
@@ -2542,9 +2577,8 @@
2542 },2577 },
2543 }2578 }
2544 parser = SubmissionParser(self.log)2579 parser = SubmissionParser(self.log)
2545 parser.buildDeviceList(parsed_data)2580 parser.buildHalDeviceList(parsed_data)
2546 found_product_id = parser.hal_devices[2581 found_product_id = parser.devices[self.UDI_SATA_CONTROLLER].product_id
2547 self.UDI_SATA_CONTROLLER].product_id
2548 self.assertEqual(found_product_id, 0x27c5,2582 self.assertEqual(found_product_id, 0x27c5,
2549 'Unexpected result of HWDevice.product_id. '2583 'Unexpected result of HWDevice.product_id. '
2550 'Expected 0x27c5, got 0x%x.'2584 'Expected 0x27c5, got 0x%x.'
@@ -2576,8 +2610,8 @@
2576 },2610 },
2577 }2611 }
2578 parser = SubmissionParser(self.log)2612 parser = SubmissionParser(self.log)
2579 parser.buildDeviceList(parsed_data)2613 parser.buildHalDeviceList(parsed_data)
2580 found_product_id = parser.hal_devices[self.UDI_SCSI_DISK].product_id2614 found_product_id = parser.devices[self.UDI_SCSI_DISK].product_id
2581 self.assertEqual(found_product_id, 'ST36530N',2615 self.assertEqual(found_product_id, 'ST36530N',
2582 'Unexpected result of HWDevice.product_id for a. '2616 'Unexpected result of HWDevice.product_id for a. '
2583 'SCSI device. Expected ST35630N, got %r.'2617 'SCSI device. Expected ST35630N, got %r.'
@@ -2605,8 +2639,8 @@
2605 },2639 },
2606 }2640 }
2607 parser = SubmissionParser(self.log)2641 parser = SubmissionParser(self.log)
2608 parser.buildDeviceList(parsed_data)2642 parser.buildHalDeviceList(parsed_data)
2609 found_product_id = parser.hal_devices[self.UDI_SCSI_DISK].product_id2643 found_product_id = parser.devices[self.UDI_SCSI_DISK].product_id
2610 self.assertEqual(found_product_id, 'HTS54161',2644 self.assertEqual(found_product_id, 'HTS54161',
2611 'Unexpected result of HWDevice.product_id for a. '2645 'Unexpected result of HWDevice.product_id for a. '
2612 'fake SCSI device. Expected HTS54161, got %r.'2646 'fake SCSI device. Expected HTS54161, got %r.'
@@ -2635,8 +2669,8 @@
2635 },2669 },
2636 }2670 }
2637 parser = SubmissionParser(self.log)2671 parser = SubmissionParser(self.log)
2638 parser.buildDeviceList(parsed_data)2672 parser.buildHalDeviceList(parsed_data)
2639 found_product_id = parser.hal_devices[self.UDI_COMPUTER].product_id2673 found_product_id = parser.devices[self.UDI_COMPUTER].product_id
2640 self.assertEqual(found_product_id, 'LIFEBOOK E8210',2674 self.assertEqual(found_product_id, 'LIFEBOOK E8210',
2641 'Unexpected result of HWDevice.product_id for a '2675 'Unexpected result of HWDevice.product_id for a '
2642 'system. Expected LIFEBOOK E8210, got %r.'2676 'system. Expected LIFEBOOK E8210, got %r.'
@@ -2672,8 +2706,8 @@
2672 properties['%s.vendor' % bus] = vendor_id2706 properties['%s.vendor' % bus] = vendor_id
2673 else:2707 else:
2674 properties['%s.vendor_id' % bus] = vendor_id2708 properties['%s.vendor_id' % bus] = vendor_id
2675 parser.buildDeviceList(parsed_data)2709 parser.buildHalDeviceList(parsed_data)
2676 found_vendor_id = parser.hal_devices[2710 found_vendor_id = parser.devices[
2677 self.UDI_SATA_DISK].vendor_id_for_db2711 self.UDI_SATA_DISK].vendor_id_for_db
2678 self.assertEqual(found_vendor_id, expected_vendor_id,2712 self.assertEqual(found_vendor_id, expected_vendor_id,
2679 'Unexpected result of HWDevice.vendor_id_for_db for bus '2713 'Unexpected result of HWDevice.vendor_id_for_db for bus '
@@ -2699,9 +2733,8 @@
2699 },2733 },
2700 }2734 }
2701 parser = SubmissionParser(self.log)2735 parser = SubmissionParser(self.log)
2702 parser.buildDeviceList(parsed_data)2736 parser.buildHalDeviceList(parsed_data)
2703 found_vendor_id = parser.hal_devices[2737 found_vendor_id = parser.devices[self.UDI_COMPUTER].vendor_id_for_db
2704 self.UDI_COMPUTER].vendor_id_for_db
2705 self.assertEqual(found_vendor_id, 'FUJITSU SIEMENS',2738 self.assertEqual(found_vendor_id, 'FUJITSU SIEMENS',
2706 'Unexpected result of HWDevice.vendor_id_for_db for system. '2739 'Unexpected result of HWDevice.vendor_id_for_db for system. '
2707 'Expected FUJITSU SIEMENS, got %r.' % found_vendor_id)2740 'Expected FUJITSU SIEMENS, got %r.' % found_vendor_id)
@@ -2737,8 +2770,8 @@
2737 properties['%s.model' % bus] = product_id2770 properties['%s.model' % bus] = product_id
2738 else:2771 else:
2739 properties['%s.product_id' % bus] = product_id2772 properties['%s.product_id' % bus] = product_id
2740 parser.buildDeviceList(parsed_data)2773 parser.buildHalDeviceList(parsed_data)
2741 found_product_id = parser.hal_devices[2774 found_product_id = parser.devices[
2742 self.UDI_SATA_DISK].product_id_for_db2775 self.UDI_SATA_DISK].product_id_for_db
2743 self.assertEqual(found_product_id, expected_product_id,2776 self.assertEqual(found_product_id, expected_product_id,
2744 'Unexpected result of HWDevice.product_id_for_db for bus '2777 'Unexpected result of HWDevice.product_id_for_db for bus '
@@ -2764,9 +2797,8 @@
2764 },2797 },
2765 }2798 }
2766 parser = SubmissionParser(self.log)2799 parser = SubmissionParser(self.log)
2767 parser.buildDeviceList(parsed_data)2800 parser.buildHalDeviceList(parsed_data)
2768 found_product_id = parser.hal_devices[2801 found_product_id = parser.devices[self.UDI_COMPUTER].product_id_for_db
2769 self.UDI_COMPUTER].product_id_for_db
2770 self.assertEqual(found_product_id, 'E8210',2802 self.assertEqual(found_product_id, 'E8210',
2771 'Unexpected result of HWDevice.product_id_for_db for system. '2803 'Unexpected result of HWDevice.product_id_for_db for system. '
2772 'Expected FUJITSU SIEMENS, got %r.' % found_product_id)2804 'Expected FUJITSU SIEMENS, got %r.' % found_product_id)
@@ -2829,16 +2861,16 @@
2829 def testUSBDeviceRegularCase(self):2861 def testUSBDeviceRegularCase(self):
2830 """Test of HALDevice.is_real_device: info.bus == 'usb_device'."""2862 """Test of HALDevice.is_real_device: info.bus == 'usb_device'."""
2831 parser = SubmissionParser(self.log)2863 parser = SubmissionParser(self.log)
2832 parser.buildDeviceList(self.parsed_data)2864 parser.buildHalDeviceList(self.parsed_data)
2833 device = parser.hal_devices[self.UDI_USB_STORAGE]2865 device = parser.devices[self.UDI_USB_STORAGE]
2834 self.failUnless(2866 self.failUnless(
2835 device.is_real_device,2867 device.is_real_device,
2836 'Testing info.bus property: Regular USB Device not treated '2868 'Testing info.bus property: Regular USB Device not treated '
2837 'as a real device.')2869 'as a real device.')
28382870
2839 self.renameInfoBusToInfoSubsystem()2871 self.renameInfoBusToInfoSubsystem()
2840 parser.buildDeviceList(self.parsed_data)2872 parser.buildHalDeviceList(self.parsed_data)
2841 device = parser.hal_devices[self.UDI_USB_STORAGE]2873 device = parser.devices[self.UDI_USB_STORAGE]
2842 self.failUnless(2874 self.failUnless(
2843 device.is_real_device,2875 device.is_real_device,
2844 'Testing info.subsystem property: Regular USB Device not treated '2876 'Testing info.subsystem property: Regular USB Device not treated '
@@ -2852,17 +2884,16 @@
2852 """2884 """
28532885
2854 parser = SubmissionParser(self.log)2886 parser = SubmissionParser(self.log)
2855 parser.buildDeviceList(self.parsed_data)2887 parser.buildHalDeviceList(self.parsed_data)
2856 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]2888 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2857 self.failIf(2889 self.failIf(
2858 device.is_real_device,2890 device.is_real_device,
2859 'Testing info.bus property: USB Device with vendor/product '2891 'Testing info.bus property: USB Device with vendor/product '
2860 'ID 0:0 property treated as a real device.')2892 'ID 0:0 property treated as a real device.')
28612893
2862 self.renameInfoBusToInfoSubsystem()2894 self.renameInfoBusToInfoSubsystem()
2863 parser.buildDeviceList(self.parsed_data)2895 parser.buildHalDeviceList(self.parsed_data)
2864 parser.buildDeviceList(self.parsed_data)2896 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2865 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2866 self.failIf(2897 self.failIf(
2867 device.is_real_device,2898 device.is_real_device,
2868 'Testing info.subsystem property: USB Device with vendor/product '2899 'Testing info.subsystem property: USB Device with vendor/product '
@@ -2879,8 +2910,8 @@
2879 parent_properties['pci.device_class'] = (PCI_CLASS_STORAGE, 'int')2910 parent_properties['pci.device_class'] = (PCI_CLASS_STORAGE, 'int')
2880 parser = SubmissionParser(self.log)2911 parser = SubmissionParser(self.log)
2881 parser.submission_key = 'USB device test 1'2912 parser.submission_key = 'USB device test 1'
2882 parser.buildDeviceList(self.parsed_data)2913 parser.buildHalDeviceList(self.parsed_data)
2883 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]2914 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2884 self.failIf(2915 self.failIf(
2885 device.is_real_device,2916 device.is_real_device,
2886 'Testing info.bus property: USB Device with vendor/product '2917 'Testing info.bus property: USB Device with vendor/product '
@@ -2892,8 +2923,8 @@
2892 + self.UDI_USB_CONTROLLER_USB_SIDE)2923 + self.UDI_USB_CONTROLLER_USB_SIDE)
28932924
2894 self.renameInfoBusToInfoSubsystem()2925 self.renameInfoBusToInfoSubsystem()
2895 parser.buildDeviceList(self.parsed_data)2926 parser.buildHalDeviceList(self.parsed_data)
2896 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]2927 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2897 self.failIf(2928 self.failIf(
2898 device.is_real_device,2929 device.is_real_device,
2899 'Testing info.subsystem property: USB Device with vendor/product '2930 'Testing info.subsystem property: USB Device with vendor/product '
@@ -2915,8 +2946,8 @@
2915 parent_properties['pci.device_subclass'] = (1, 'int')2946 parent_properties['pci.device_subclass'] = (1, 'int')
2916 parser = SubmissionParser(self.log)2947 parser = SubmissionParser(self.log)
2917 parser.submission_key = 'USB device test 2'2948 parser.submission_key = 'USB device test 2'
2918 parser.buildDeviceList(self.parsed_data)2949 parser.buildHalDeviceList(self.parsed_data)
2919 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]2950 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2920 self.failIf(2951 self.failIf(
2921 device.is_real_device,2952 device.is_real_device,
2922 'Testing info.bus property: USB Device with vendor/product '2953 'Testing info.bus property: USB Device with vendor/product '
@@ -2928,8 +2959,8 @@
2928 + self.UDI_USB_CONTROLLER_USB_SIDE)2959 + self.UDI_USB_CONTROLLER_USB_SIDE)
29292960
2930 self.renameInfoBusToInfoSubsystem()2961 self.renameInfoBusToInfoSubsystem()
2931 parser.buildDeviceList(self.parsed_data)2962 parser.buildHalDeviceList(self.parsed_data)
2932 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]2963 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2933 self.failIf(2964 self.failIf(
2934 device.is_real_device,2965 device.is_real_device,
2935 'Testing info.subsystem property: USB Device with vendor/product '2966 'Testing info.subsystem property: USB Device with vendor/product '
@@ -2951,8 +2982,8 @@
2951 parent_properties['info.bus'] = ('not pci', 'str')2982 parent_properties['info.bus'] = ('not pci', 'str')
2952 parser = SubmissionParser(self.log)2983 parser = SubmissionParser(self.log)
2953 parser.submission_key = 'USB device test 3'2984 parser.submission_key = 'USB device test 3'
2954 parser.buildDeviceList(self.parsed_data)2985 parser.buildHalDeviceList(self.parsed_data)
2955 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]2986 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2956 self.failIf(2987 self.failIf(
2957 device.is_real_device,2988 device.is_real_device,
2958 'Testing info.bus property: USB Device with vendor/product '2989 'Testing info.bus property: USB Device with vendor/product '
@@ -2966,15 +2997,15 @@
2966 # All other devices which have an info.bus property return True2997 # All other devices which have an info.bus property return True
2967 # for HALDevice.is_real_device. The USB host controller in the2998 # for HALDevice.is_real_device. The USB host controller in the
2968 # test data is an example.2999 # test data is an example.
2969 device = parser.hal_devices[self.UDI_USB_CONTROLLER_PCI_SIDE]3000 device = parser.devices[self.UDI_USB_CONTROLLER_PCI_SIDE]
2970 self.failUnless(3001 self.failUnless(
2971 device.is_real_device,3002 device.is_real_device,
2972 'Testing info.bus property: Device with existing info.bus '3003 'Testing info.bus property: Device with existing info.bus '
2973 'property not treated as a real device.')3004 'property not treated as a real device.')
29743005
2975 self.renameInfoBusToInfoSubsystem()3006 self.renameInfoBusToInfoSubsystem()
2976 parser.buildDeviceList(self.parsed_data)3007 parser.buildHalDeviceList(self.parsed_data)
2977 device = parser.hal_devices[self.UDI_USB_CONTROLLER_USB_SIDE]3008 device = parser.devices[self.UDI_USB_CONTROLLER_USB_SIDE]
2978 self.failIf(3009 self.failIf(
2979 device.is_real_device,3010 device.is_real_device,
2980 'Testing info.subsystem property: USB Device with vendor/product '3011 'Testing info.subsystem property: USB Device with vendor/product '
@@ -2985,7 +3016,7 @@
2985 'parent device does not look like a USB host controller: '3016 'parent device does not look like a USB host controller: '
2986 + self.UDI_USB_CONTROLLER_USB_SIDE)3017 + self.UDI_USB_CONTROLLER_USB_SIDE)
29873018
2988 device = parser.hal_devices[self.UDI_USB_CONTROLLER_PCI_SIDE]3019 device = parser.devices[self.UDI_USB_CONTROLLER_PCI_SIDE]
2989 self.failUnless(3020 self.failUnless(
2990 device.is_real_device,3021 device.is_real_device,
2991 'Testing info.subsystem property: Device with existing info.bus '3022 'Testing info.subsystem property: Device with existing info.bus '
@@ -4318,7 +4349,7 @@
4318 self.setHALDevices(devices)4349 self.setHALDevices(devices)
4319 parser = SubmissionParser(self.log)4350 parser = SubmissionParser(self.log)
4320 parser.buildDeviceList(self.parsed_data)4351 parser.buildDeviceList(self.parsed_data)
4321 device = parser.hal_devices[self.UDI_COMPUTER]4352 device = parser.devices[self.UDI_COMPUTER]
4322 self.assertEqual(device.getDriver(), None,4353 self.assertEqual(device.getDriver(), None,
4323 'HALDevice.getDriver found a driver where none is expected.')4354 'HALDevice.getDriver found a driver where none is expected.')
43244355
@@ -4332,7 +4363,7 @@
4332 parser = SubmissionParser(self.log)4363 parser = SubmissionParser(self.log)
4333 parser.parsed_data = self.parsed_data4364 parser.parsed_data = self.parsed_data
4334 parser.buildDeviceList(self.parsed_data)4365 parser.buildDeviceList(self.parsed_data)
4335 device = parser.hal_devices[self.UDI_PCI_PCCARD_BRIDGE]4366 device = parser.devices[self.UDI_PCI_PCCARD_BRIDGE]
4336 driver = device.getDriver()4367 driver = device.getDriver()
4337 self.assertNotEqual(driver, None,4368 self.assertNotEqual(driver, None,
4338 'HALDevice.getDriver did not find a driver where one '4369 'HALDevice.getDriver did not find a driver where one '
@@ -4372,7 +4403,7 @@
43724403
4373 # HALDevice.ensureVendorIDVendorNameExists() creates these4404 # HALDevice.ensureVendorIDVendorNameExists() creates these
4374 # records.4405 # records.
4375 hal_system = parser.hal_devices[self.UDI_COMPUTER]4406 hal_system = parser.devices[self.UDI_COMPUTER]
4376 hal_system.ensureVendorIDVendorNameExists()4407 hal_system.ensureVendorIDVendorNameExists()
43774408
4378 vendor_name = vendor_name_set.getByName('Lenovo')4409 vendor_name = vendor_name_set.getByName('Lenovo')
@@ -4400,7 +4431,7 @@
4400 parser.parsed_data = self.parsed_data4431 parser.parsed_data = self.parsed_data
4401 parser.buildDeviceList(self.parsed_data)4432 parser.buildDeviceList(self.parsed_data)
44024433
4403 hal_device = parser.hal_devices[test_udi]4434 hal_device = parser.devices[test_udi]
4404 hal_device.ensureVendorIDVendorNameExists()4435 hal_device.ensureVendorIDVendorNameExists()
44054436
4406 vendor_id_set = getUtility(IHWVendorIDSet)4437 vendor_id_set = getUtility(IHWVendorIDSet)
@@ -4474,7 +4505,7 @@
44744505
4475 # HALDevice.ensureVendorIDVendorNameExists() creates these4506 # HALDevice.ensureVendorIDVendorNameExists() creates these
4476 # records.4507 # records.
4477 scsi_disk = parser.hal_devices[self.UDI_SCSI_DISK]4508 scsi_disk = parser.devices[self.UDI_SCSI_DISK]
4478 scsi_disk.ensureVendorIDVendorNameExists()4509 scsi_disk.ensureVendorIDVendorNameExists()
44794510
4480 vendor_name = vendor_name_set.getByName('WDC')4511 vendor_name = vendor_name_set.getByName('WDC')
@@ -4506,7 +4537,7 @@
4506 submission_set = getUtility(IHWSubmissionSet)4537 submission_set = getUtility(IHWSubmissionSet)
4507 submission = submission_set.getBySubmissionKey('test_submission_id_1')4538 submission = submission_set.getBySubmissionKey('test_submission_id_1')
45084539
4509 hal_device = parser.hal_devices[self.UDI_COMPUTER]4540 hal_device = parser.devices[self.UDI_COMPUTER]
4510 hal_device.createDBData(submission, None)4541 hal_device.createDBData(submission, None)
45114542
4512 # HALDevice.createDBData created a HWDevice record.4543 # HALDevice.createDBData created a HWDevice record.
@@ -4573,7 +4604,7 @@
4573 submission_set = getUtility(IHWSubmissionSet)4604 submission_set = getUtility(IHWSubmissionSet)
4574 submission = submission_set.getBySubmissionKey('test_submission_id_1')4605 submission = submission_set.getBySubmissionKey('test_submission_id_1')
45754606
4576 hal_root_device = parser.hal_devices[self.UDI_COMPUTER]4607 hal_root_device = parser.devices[self.UDI_COMPUTER]
4577 hal_root_device.createDBData(submission, None)4608 hal_root_device.createDBData(submission, None)
45784609
4579 # We now have a HWDevice record for the PCCard bridge...4610 # We now have a HWDevice record for the PCCard bridge...
@@ -4680,7 +4711,7 @@
4680 submission_set = getUtility(IHWSubmissionSet)4711 submission_set = getUtility(IHWSubmissionSet)
4681 submission = submission_set.getBySubmissionKey('test_submission_id_1')4712 submission = submission_set.getBySubmissionKey('test_submission_id_1')
46824713
4683 hal_root_device = parser.hal_devices[self.UDI_COMPUTER]4714 hal_root_device = parser.devices[self.UDI_COMPUTER]
4684 hal_root_device.createDBData(submission, None)4715 hal_root_device.createDBData(submission, None)
46854716
4686 # The USB controller has a HWDevice record.4717 # The USB controller has a HWDevice record.
@@ -4934,6 +4965,24 @@
4934 self.failIf(4965 self.failIf(
4935 result, 'Submission with inconsistent data treated as valid.')4966 result, 'Submission with inconsistent data treated as valid.')
49364967
4968 def test_processSubmission_buildDeviceList_failing(self):
4969 """Test of SubmissionParser.processSubmission().
4970
4971 If the method buildDeviceList() fails for a submission, it is
4972 rejected.
4973 """
4974 def no(*args, **kw):
4975 return False
4976
4977 submission_key = 'builddevicelist-fails'
4978 submission_data = self.getSampleData(
4979 'simple_valid_hwdb_submission.xml')
4980 submission = self.createSubmissionData(
4981 submission_data, False, submission_key)
4982 parser = SubmissionParser()
4983 parser.buildDeviceList = no
4984 self.assertFalse(parser.processSubmission(submission))
4985
4937 def testProcessSubmissionRealData(self):4986 def testProcessSubmissionRealData(self):
4938 """Test of SubmissionParser.processSubmission().4987 """Test of SubmissionParser.processSubmission().
49394988
49404989
=== modified file 'lib/lp/registry/browser/product.py'