~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-30 00:58:33 UTC
  • mfrom: (13800.1.2 test-hwsubm)
  • Revision ID: launchpad@pqm.canonical.com-20110830005833-cqgf23ogpvg222ns
[r=flacoste][bug=835103] allow to process HWDB submissions from the
        checkbox version in Lucid, Maverick, Natty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
349
349
        self.assertIs(
350
350
            None, parser.devices[pci_ethernet_controller_path].sysfs)
351
351
 
 
352
    def test_buildUdevDeviceList_no_sysfs_data(self):
 
353
        """Sysfs data is not required (maverick and natty submissions)."""
 
354
        root_device_path = '/devices/LNXSYSTM:00'
 
355
        pci_pci_bridge_path = '/devices/pci0000:00/0000:00:1c.0'
 
356
        pci_ethernet_controller_path = (
 
357
            '/devices/pci0000:00/0000:00:1c.0/0000:02:00.0')
 
358
 
 
359
        udev_paths = (
 
360
            root_device_path, pci_pci_bridge_path,
 
361
            pci_ethernet_controller_path)
 
362
 
 
363
        sysfs_data = None
 
364
 
 
365
        parsed_data = self.makeUdevDeviceParsedData(udev_paths, sysfs_data)
 
366
        parser = SubmissionParser()
 
367
        parser.buildUdevDeviceList(parsed_data)
 
368
 
 
369
        self.assertIs(
 
370
            None, parser.devices[pci_pci_bridge_path].sysfs)
 
371
 
 
372
        self.assertIs(
 
373
            None, parser.devices[pci_ethernet_controller_path].sysfs)
 
374
 
352
375
    def test_buildUdevDeviceList_invalid_device_path(self):
353
376
        """Test the creation of UdevDevice instances for a submission.
354
377
 
3875
3898
        device = UdevDevice(None, self.root_device)
3876
3899
        self.assertFalse(device.is_scsi_device)
3877
3900
 
 
3901
    def test_is_scsi_device__no_sysfs_data(self):
 
3902
        """Test of UdevDevice.is_scsi_device.
 
3903
 
 
3904
        If there is no sysfs data for a real SCSI device, is it not
 
3905
        considered as a real SCSI device.
 
3906
 
 
3907
        Reason: Without sysfs data, we don't know the vendor and
 
3908
        model name, making it impossible to store data about the
 
3909
        device in the database.
 
3910
        """
 
3911
        device = UdevDevice(
 
3912
            None, self.scsi_scanner_device_data, None)
 
3913
        self.assertFalse(device.is_scsi_device)
 
3914
 
3878
3915
    def test_scsi_vendor(self):
3879
3916
        """Test of UdevDevice.scsi_vendor."""
3880
3917
        device = UdevDevice(