1# Copyright 2021 The ChromiumOS Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4"""Test for Hwid merging plugin""" 5 6import unittest 7 8from chromiumos.config.api.component_pb2 import Component 9from chromiumos.config.payload.config_bundle_pb2 import ConfigBundle 10from .merge_hwid import _set_support_status, MergeHwid 11 12 13def _mock_hwid_component(type_name, label, values): 14 return { 15 'components': { 16 type_name: { 17 'items': { 18 label: { 19 'values': values 20 }, 21 }, 22 }, 23 }, 24 } 25 26 27class MergeHWidTests(unittest.TestCase): 28 """Tests for MergeHwid plugin.""" 29 30 # pylint: disable=too-many-public-methods 31 32 def test_support_status(self): 33 """Test the _set_support_status functionality.""" 34 bundle = ConfigBundle() 35 36 # With no status information, our support status should be unknown. 37 component = bundle.components.add() 38 component = _set_support_status(component, {}) 39 self.assertEqual( 40 component.support_status, 41 component.SupportStatus.STATUS_UNKNOWN, 42 ) 43 44 # A known status should get reflected into component. 45 component = bundle.components.add() 46 component = _set_support_status(component, {'status': 'supported'}) 47 self.assertEqual( 48 component.support_status, 49 component.SupportStatus.STATUS_SUPPORTED, 50 ) 51 52 # An unknown status value should _not_ get reflected into component. 53 component = bundle.components.add() 54 component = _set_support_status(component, {'status': 'fooble'}) 55 self.assertEqual( 56 component.support_status, 57 component.SupportStatus.STATUS_UNKNOWN, 58 ) 59 60 def test_audio_codec(self): 61 """Test basic audio codec functionality.""" 62 test_label = 'ACLABEL123' 63 test_name = 'ACLABEL:123' 64 65 hwid = _mock_hwid_component( 66 'audio_codec', 67 test_label, 68 {'name': test_name}, 69 ) 70 71 bundle = ConfigBundle() 72 merger = MergeHwid(hwid_data=hwid) 73 merger.merge(bundle) 74 75 self.assertEqual(len(bundle.components), 1) 76 component = bundle.components[0] 77 self.assertEqual(component.hwid_type, 'audio_codec') 78 self.assertEqual(component.hwid_label, test_label) 79 self.assertEqual(component.id.value, test_label) 80 self.assertEqual(component.name, test_name) 81 self.assertEqual(component.audio_codec.name, test_name) 82 83 # Should be nothing unparsed 84 self.assertEqual(merger.residual(), {}) 85 86 def test_battery(self): 87 """Test basic battery functionality.""" 88 test_label = 'battery123' 89 test_oem = 'conglomo' 90 test_model = 'battery-123-abc' 91 test_tech = 'li-poly' 92 93 hwid = _mock_hwid_component( 94 'battery', 95 test_label, 96 { 97 'manufacturer': test_oem, 98 'model_name': test_model, 99 'technology': test_tech, 100 }, 101 ) 102 103 bundle = ConfigBundle() 104 merger = MergeHwid(hwid_data=hwid) 105 merger.merge(bundle) 106 107 self.assertEqual(len(bundle.components), 1) 108 component = bundle.components[0] 109 self.assertEqual(component.hwid_type, 'battery') 110 self.assertEqual(component.hwid_label, test_label) 111 self.assertEqual(component.id.value, test_label) 112 self.assertEqual(component.manufacturer_id.value, test_oem) 113 self.assertEqual(component.battery.model, test_model) 114 self.assertEqual(component.battery.technology, Component.Battery.LI_POLY) 115 116 # Should be nothing unparsed 117 self.assertEqual(merger.residual(), {}) 118 119 def test_bluetooth(self): 120 """Test basic bluetooth functionality.""" 121 test_label = 'bluetooth123' 122 test_vendor = 'vendor' 123 test_product = 'product' 124 test_bcd = 'bcd' 125 126 hwid = _mock_hwid_component( 127 'bluetooth', 128 test_label, 129 { 130 'idVendor': test_vendor, 131 'idProduct': test_product, 132 'bcdDevice': test_bcd, 133 }, 134 ) 135 136 bundle = ConfigBundle() 137 merger = MergeHwid(hwid_data=hwid) 138 merger.merge(bundle) 139 140 self.assertEqual(len(bundle.components), 1) 141 component = bundle.components[0] 142 self.assertEqual(component.hwid_type, 'bluetooth') 143 self.assertEqual(component.hwid_label, test_label) 144 self.assertEqual(component.id.value, test_label) 145 self.assertEqual(component.bluetooth.usb.vendor_id, test_vendor) 146 self.assertEqual(component.bluetooth.usb.product_id, test_product) 147 self.assertEqual(component.bluetooth.usb.bcd_device, test_bcd) 148 149 # Should be nothing unparsed 150 self.assertEqual(merger.residual(), {}) 151 152 def test_cellular(self): 153 """Test basic cellular functionality.""" 154 test_label = 'cellular123' 155 test_vendor = 'vendor' 156 test_product = 'product' 157 test_bcd = 'bcd' 158 159 hwid = _mock_hwid_component( 160 'cellular', 161 test_label, 162 { 163 'idVendor': test_vendor, 164 'idProduct': test_product, 165 'bcdDevice': test_bcd, 166 }, 167 ) 168 169 bundle = ConfigBundle() 170 merger = MergeHwid(hwid_data=hwid) 171 merger.merge(bundle) 172 173 self.assertEqual(len(bundle.components), 1) 174 component = bundle.components[0] 175 self.assertEqual(component.hwid_type, 'cellular') 176 self.assertEqual(component.hwid_label, test_label) 177 self.assertEqual(component.id.value, test_label) 178 self.assertEqual(component.cellular.usb.vendor_id, test_vendor) 179 self.assertEqual(component.cellular.usb.product_id, test_product) 180 self.assertEqual(component.cellular.usb.bcd_device, test_bcd) 181 182 # Should be nothing unparsed 183 self.assertEqual(merger.residual(), {}) 184 185 def test_cpu(self): 186 """Test basic cpu functionality.""" 187 test_label = 'some_cpu_123' 188 test_model = 'intel i3-5005U' 189 test_cores = 4 190 191 hwid = _mock_hwid_component( 192 'cpu', 193 test_label, 194 { 195 'model': test_model, 196 'cores': test_cores, 197 }, 198 ) 199 200 bundle = ConfigBundle() 201 merger = MergeHwid(hwid_data=hwid) 202 merger.merge(bundle) 203 204 self.assertEqual(len(bundle.components), 1) 205 component = bundle.components[0] 206 self.assertEqual(component.hwid_type, 'cpu') 207 self.assertEqual(component.hwid_label, test_label) 208 self.assertEqual(component.id.value, test_label) 209 self.assertEqual(component.soc.family.arch, component.soc.X86_64) 210 self.assertEqual(component.soc.cores, 4) 211 self.assertEqual(component.soc.family.name, 'I3-5005U') 212 213 # Should be nothing unparsed 214 self.assertEqual(merger.residual(), {}) 215 216 def test_cpu_nocores(self): 217 """Test cpu entry without cores field.""" 218 test_label = 'some_cpu_123' 219 test_model = 'intel i3-5005U' 220 221 hwid = _mock_hwid_component( 222 'cpu', 223 test_label, 224 { 225 'model': test_model, 226 }, 227 ) 228 229 bundle = ConfigBundle() 230 merger = MergeHwid(hwid_data=hwid) 231 merger.merge(bundle) 232 233 self.assertEqual(len(bundle.components), 1) 234 component = bundle.components[0] 235 self.assertEqual(component.hwid_type, 'cpu') 236 self.assertEqual(component.hwid_label, test_label) 237 self.assertEqual(component.id.value, test_label) 238 self.assertEqual(component.soc.cores, 0) 239 240 # Should be nothing unparsed 241 self.assertEqual(merger.residual(), {}) 242 243 def test_display_panel(self): 244 """Test basic display panel functionality.""" 245 test_label = 'some_cpu_123' 246 test_vendor = 'ABCCo' 247 test_product_id = 'panel_1a_niner' 248 test_width = 800 249 test_height = 480 250 251 hwid = _mock_hwid_component( 252 'display_panel', 253 test_label, 254 { 255 'vendor': test_vendor, 256 'product_id': test_product_id, 257 'width': test_width, 258 'height': test_height, 259 }, 260 ) 261 262 bundle = ConfigBundle() 263 merger = MergeHwid(hwid_data=hwid) 264 merger.merge(bundle) 265 266 self.assertEqual(len(bundle.components), 1) 267 component = bundle.components[0] 268 self.assertEqual(component.hwid_type, 'display_panel') 269 self.assertEqual(component.hwid_label, test_label) 270 self.assertEqual(component.id.value, test_label) 271 self.assertEqual(component.manufacturer_id.value, test_vendor) 272 self.assertEqual(component.display_panel.product_id, test_product_id) 273 self.assertEqual(component.display_panel.properties.width_px, test_width) 274 self.assertEqual(component.display_panel.properties.height_px, test_height) 275 276 # Should be nothing unparsed 277 self.assertEqual(merger.residual(), {}) 278 279 def test_dram(self): 280 """Test basic display panel functionality.""" 281 test_label = 'some_dram_123abc_0' 282 test_part = '1234abcd' 283 test_size = 2048 284 285 test_timings = [ 286 ('LPDDR4', Component.Memory.LP_DDR4), 287 ('LPDDR3', Component.Memory.LP_DDR3), 288 ('DDR4', Component.Memory.DDR4), 289 ('DDR3', Component.Memory.DDR3), 290 ('DDR2', Component.Memory.DDR2), 291 ('DDR', Component.Memory.DDR), 292 ] 293 294 for memory_timing, memory_type in test_timings: 295 hwid = _mock_hwid_component( 296 'dram', 297 test_label, 298 { 299 'part': test_part, 300 'size': str(test_size), 301 'timing': memory_timing 302 }, 303 ) 304 305 bundle = ConfigBundle() 306 merger = MergeHwid(hwid_data=hwid) 307 merger.merge(bundle) 308 309 self.assertEqual(len(bundle.components), 1) 310 component = bundle.components[0] 311 self.assertEqual(component.hwid_type, 'dram') 312 self.assertEqual(component.hwid_label, test_label) 313 self.assertEqual(component.id.value, test_label) 314 self.assertEqual(component.memory.part_number, test_part) 315 self.assertEqual(component.memory.profile.size_megabytes, test_size) 316 self.assertEqual(component.memory.profile.type, memory_type) 317 318 # Should be nothing unparsed 319 self.assertEqual(merger.residual(), {}) 320 321 def test_ec_flash(self): 322 """Test basic ec_flash functionality.""" 323 test_label = 'some_flash_chip_123abc' 324 test_part = '1234abcd' 325 test_vendor = 'TestVendorCo' 326 327 hwid = _mock_hwid_component( 328 'ec_flash_chip', 329 test_label, 330 { 331 'name': test_part, 332 'vendor': test_vendor 333 }, 334 ) 335 336 bundle = ConfigBundle() 337 merger = MergeHwid(hwid_data=hwid) 338 merger.merge(bundle) 339 340 self.assertEqual(len(bundle.components), 1) 341 component = bundle.components[0] 342 self.assertEqual(component.hwid_type, 'ec_flash_chip') 343 self.assertEqual(component.hwid_label, test_label) 344 self.assertEqual(component.ec_flash_chip.part_number, test_part) 345 self.assertEqual(component.manufacturer_id.value, test_vendor) 346 347 # Should be nothing unparsed 348 self.assertEqual(merger.residual(), {}) 349 350 def test_ec(self): 351 """Test basic ec functionality.""" 352 test_label = 'some_ec_123abc' 353 test_part = '1234abcd' 354 test_vendor = 'TestVendorCo' 355 356 hwid = _mock_hwid_component( 357 'embedded_controller', 358 test_label, 359 { 360 'name': test_part, 361 'vendor': test_vendor 362 }, 363 ) 364 365 bundle = ConfigBundle() 366 merger = MergeHwid(hwid_data=hwid) 367 merger.merge(bundle) 368 369 self.assertEqual(len(bundle.components), 1) 370 component = bundle.components[0] 371 self.assertEqual(component.hwid_type, 'embedded_controller') 372 self.assertEqual(component.hwid_label, test_label) 373 self.assertEqual(component.ec.part_number, test_part) 374 self.assertEqual(component.manufacturer_id.value, test_vendor) 375 376 # Should be nothing unparsed 377 self.assertEqual(merger.residual(), {}) 378 379 def test_flash(self): 380 """Test basic flash functionality.""" 381 test_label = 'some_flash_123abc' 382 test_part = '1234abcd' 383 test_vendor = 'TestVendorCo' 384 385 hwid = _mock_hwid_component( 386 'flash_chip', 387 test_label, 388 { 389 'name': test_part, 390 'vendor': test_vendor 391 }, 392 ) 393 394 bundle = ConfigBundle() 395 merger = MergeHwid(hwid_data=hwid) 396 merger.merge(bundle) 397 398 self.assertEqual(len(bundle.components), 1) 399 component = bundle.components[0] 400 self.assertEqual(component.hwid_type, 'flash_chip') 401 self.assertEqual(component.hwid_label, test_label) 402 self.assertEqual(component.system_flash_chip.part_number, test_part) 403 self.assertEqual(component.manufacturer_id.value, test_vendor) 404 405 # Should be nothing unparsed 406 self.assertEqual(merger.residual(), {}) 407 408 def test_storage(self): 409 """Test basic storage functionality.""" 410 test_label = 'some_storage_123abc' 411 test_emmc5 = '1.2.3' 412 test_manfid = 'manfid' 413 test_name = 'Name' 414 test_oemid = 'oemid' 415 test_prv = 'prv' 416 test_sectors = 'sectors' 417 test_type = 'MMC' 418 419 hwid = _mock_hwid_component( 420 'storage', 421 test_label, 422 { 423 'emmc5_fw_ver': test_emmc5, 424 'manfid': test_manfid, 425 'name': test_name, 426 'oemid': test_oemid, 427 'prv': test_prv, 428 'sectors': test_sectors, 429 'type': test_type, 430 }, 431 ) 432 433 bundle = ConfigBundle() 434 merger = MergeHwid(hwid_data=hwid) 435 merger.merge(bundle) 436 437 self.assertEqual(len(bundle.components), 1) 438 component = bundle.components[0] 439 self.assertEqual(component.hwid_type, 'storage') 440 self.assertEqual(component.hwid_label, test_label) 441 self.assertEqual(component.storage.emmc5_fw_ver, test_emmc5) 442 self.assertEqual(component.storage.manfid, test_manfid) 443 self.assertEqual(component.storage.name, test_name) 444 self.assertEqual(component.storage.oemid, test_oemid) 445 self.assertEqual(component.storage.prv, test_prv) 446 self.assertEqual(component.storage.sectors, test_sectors) 447 self.assertEqual(component.storage.type, Component.Storage.EMMC) 448 449 # Should be nothing unparsed 450 self.assertEqual(merger.residual(), {}) 451 452 def test_stylus_i2c(self): 453 """Test stylus I2C functionality.""" 454 test_label = 'some_touch_123abc' 455 test_vendor = '0x1234' 456 test_product = '0xbeef' 457 458 hwid = _mock_hwid_component( 459 'stylus', 460 test_label, 461 { 462 'vendor': test_vendor, 463 'product': test_product, 464 }, 465 ) 466 467 bundle = ConfigBundle() 468 merger = MergeHwid(hwid_data=hwid) 469 merger.merge(bundle) 470 471 self.assertEqual(len(bundle.components), 1) 472 component = bundle.components[0] 473 self.assertEqual(component.hwid_type, 'stylus') 474 self.assertEqual(component.hwid_label, test_label) 475 self.assertEqual(component.stylus.i2c.product, test_product) 476 self.assertEqual(component.stylus.i2c.vendor, test_vendor) 477 478 # Should be nothing unparsed 479 self.assertEqual(merger.residual(), {}) 480 481 def test_stylus_usb(self): 482 """Test stylus USB functionality.""" 483 test_label = 'some_touch_123abc' 484 test_vendorid = '0x1234' 485 test_productid = '0xbeef' 486 test_bcd_device = 'bcd' 487 488 hwid = _mock_hwid_component( 489 'stylus', 490 test_label, 491 { 492 'vendor_id': test_vendorid, 493 'product_id': test_productid, 494 'bcd_device': test_bcd_device, 495 }, 496 ) 497 498 bundle = ConfigBundle() 499 merger = MergeHwid(hwid_data=hwid) 500 merger.merge(bundle) 501 502 self.assertEqual(len(bundle.components), 1) 503 component = bundle.components[0] 504 self.assertEqual(component.hwid_type, 'stylus') 505 self.assertEqual(component.hwid_label, test_label) 506 self.assertEqual(component.stylus.usb.product_id, test_productid) 507 self.assertEqual(component.stylus.usb.vendor_id, test_vendorid) 508 self.assertEqual(component.stylus.usb.bcd_device, test_bcd_device) 509 510 # Should be nothing unparsed 511 self.assertEqual(merger.residual(), {}) 512 513 def test_touchpad_usb(self): 514 """Test touchpad USB functionality.""" 515 test_label = 'some_touchpad_123abc' 516 test_product = 'product' 517 test_vendor = 'vendor' 518 519 hwid = _mock_hwid_component( 520 'touchpad', 521 test_label, 522 { 523 'product': test_product, 524 'vendor': test_vendor, 525 }, 526 ) 527 528 bundle = ConfigBundle() 529 merger = MergeHwid(hwid_data=hwid) 530 merger.merge(bundle) 531 532 self.assertEqual(len(bundle.components), 1) 533 component = bundle.components[0] 534 self.assertEqual(component.hwid_type, 'touchpad') 535 self.assertEqual(component.hwid_label, test_label) 536 self.assertEqual(component.touchpad.type, Component.Touch.USB) 537 self.assertEqual(component.touchpad.usb.product_id, test_product) 538 self.assertEqual(component.touchpad.usb.vendor_id, test_vendor) 539 540 # Should be nothing unparsed 541 self.assertEqual(merger.residual(), {}) 542 543 def test_touchpad_i2c(self): 544 """Test touchpad I2C functionality.""" 545 test_label = 'some_touchpad_123abc' 546 test_fw_version = '1.2.3' 547 test_fw_csum = 'csum' 548 549 hwid = _mock_hwid_component( 550 'touchpad', 551 test_label, 552 { 553 'fw_version': test_fw_version, 554 'fw_csum': test_fw_csum 555 }, 556 ) 557 558 bundle = ConfigBundle() 559 merger = MergeHwid(hwid_data=hwid) 560 merger.merge(bundle) 561 562 self.assertEqual(len(bundle.components), 1) 563 component = bundle.components[0] 564 self.assertEqual(component.hwid_type, 'touchpad') 565 self.assertEqual(component.hwid_label, test_label) 566 self.assertEqual(component.touchpad.type, Component.Touch.I2C) 567 self.assertEqual(component.touchpad.fw_version, test_fw_version) 568 self.assertEqual(component.touchpad.fw_checksum, test_fw_csum) 569 570 # Should be nothing unparsed 571 self.assertEqual(merger.residual(), {}) 572 573 def test_tpm(self): 574 """Test tpm functionality.""" 575 test_label = 'some_tpm_123abc' 576 test_mfg_info = 'TPMCo' 577 test_version = '1.2.3' 578 579 hwid = _mock_hwid_component( 580 'tpm', 581 test_label, 582 { 583 'manufacturer_info': test_mfg_info, 584 'version': test_version 585 }, 586 ) 587 588 bundle = ConfigBundle() 589 merger = MergeHwid(hwid_data=hwid) 590 merger.merge(bundle) 591 592 self.assertEqual(len(bundle.components), 1) 593 component = bundle.components[0] 594 self.assertEqual(component.hwid_type, 'tpm') 595 self.assertEqual(component.hwid_label, test_label) 596 self.assertEqual(component.tpm.manufacturer_info, test_mfg_info) 597 self.assertEqual(component.tpm.version, test_version) 598 599 # Should be nothing unparsed 600 self.assertEqual(merger.residual(), {}) 601 602 def test_touchscreen(self): 603 """Test touchscreen functionality.""" 604 test_label = 'some_touch_123abc' 605 test_vendor = '0x1234' 606 test_product = '0xbeef' 607 608 hwid = _mock_hwid_component( 609 'touchscreen', 610 test_label, 611 { 612 'vendor': test_vendor, 613 'product': test_product, 614 }, 615 ) 616 617 bundle = ConfigBundle() 618 merger = MergeHwid(hwid_data=hwid) 619 merger.merge(bundle) 620 621 self.assertEqual(len(bundle.components), 1) 622 component = bundle.components[0] 623 self.assertEqual(component.hwid_type, 'touchscreen') 624 self.assertEqual(component.hwid_label, test_label) 625 self.assertEqual(component.touchscreen.usb.product_id, test_product) 626 self.assertEqual(component.touchscreen.usb.vendor_id, test_vendor) 627 self.assertEqual(component.touchscreen.type, Component.Touch.USB) 628 629 # Should be nothing unparsed 630 self.assertEqual(merger.residual(), {}) 631 632 def test_usb_hosts(self): 633 """Test USB hosts functionality.""" 634 test_label = 'some_touch_123abc' 635 test_mfg = 'ChipCo' 636 test_device = '0x1234' 637 test_vendor = '0xabcd' 638 test_revision = '123' 639 640 hwid = _mock_hwid_component( 641 'usb_hosts', 642 test_label, 643 { 644 'manufacturer': test_mfg, 645 'device': test_device, 646 'vendor': test_vendor, 647 'revision_id': test_revision 648 }, 649 ) 650 651 bundle = ConfigBundle() 652 merger = MergeHwid(hwid_data=hwid) 653 merger.merge(bundle) 654 655 self.assertEqual(len(bundle.components), 1) 656 component = bundle.components[0] 657 self.assertEqual(component.hwid_type, 'usb_hosts') 658 self.assertEqual(component.hwid_label, test_label) 659 self.assertEqual(component.manufacturer_id.value, test_mfg) 660 self.assertEqual(component.usb_host.product_id, test_device) 661 self.assertEqual(component.usb_host.vendor_id, test_vendor) 662 663 # Should be nothing unparsed 664 self.assertEqual(merger.residual(), {}) 665 666 def test_video_usb(self): 667 """Test USB video functionality.""" 668 test_label = 'some_touch_123abc' 669 test_product = '0x1234' 670 test_vendor = '0xabcd' 671 test_bcd = '12' 672 673 hwid = _mock_hwid_component( 674 'video', 675 test_label, 676 { 677 'bus_type': 'usb', 678 'idProduct': test_product, 679 'idVendor': test_vendor, 680 'bcdDevice': test_bcd 681 }, 682 ) 683 684 bundle = ConfigBundle() 685 merger = MergeHwid(hwid_data=hwid) 686 merger.merge(bundle) 687 688 self.assertEqual(len(bundle.components), 1) 689 component = bundle.components[0] 690 self.assertEqual(component.hwid_type, 'video') 691 self.assertEqual(component.hwid_label, test_label) 692 self.assertEqual(component.camera.usb.product_id, test_product) 693 self.assertEqual(component.camera.usb.vendor_id, test_vendor) 694 self.assertEqual(component.camera.usb.bcd_device, test_bcd) 695 696 # Should be nothing unparsed 697 self.assertEqual(merger.residual(), {}) 698 699 def test_video_pci(self): 700 """Test PCI video functionality.""" 701 test_label = 'some_touch_123abc' 702 test_vendor = '0xabcd' 703 test_device = '0x1234' 704 test_revision = '12' 705 706 hwid = _mock_hwid_component( 707 'video', 708 test_label, 709 { 710 'bus_type': 'pci', 711 'vendor': test_vendor, 712 'device': test_device, 713 'revision_id': test_revision 714 }, 715 ) 716 717 bundle = ConfigBundle() 718 merger = MergeHwid(hwid_data=hwid) 719 merger.merge(bundle) 720 721 self.assertEqual(len(bundle.components), 1) 722 component = bundle.components[0] 723 self.assertEqual(component.hwid_type, 'video') 724 self.assertEqual(component.hwid_label, test_label) 725 self.assertEqual(component.camera.pci.vendor_id, test_vendor) 726 self.assertEqual(component.camera.pci.device_id, test_device) 727 self.assertEqual(component.camera.pci.revision_id, test_revision) 728 729 # Should be nothing unparsed 730 self.assertEqual(merger.residual(), {}) 731 732 def test_wireless(self): 733 """Test wireless functionality.""" 734 test_label = 'some_touch_123abc' 735 test_vendor = '0xabcd' 736 test_device = '0x1234' 737 test_revision = '12' 738 739 hwid = _mock_hwid_component( 740 'wireless', 741 test_label, 742 { 743 'vendor': test_vendor, 744 'device': test_device, 745 'revision_id': test_revision 746 }, 747 ) 748 749 bundle = ConfigBundle() 750 merger = MergeHwid(hwid_data=hwid) 751 merger.merge(bundle) 752 753 self.assertEqual(len(bundle.components), 1) 754 component = bundle.components[0] 755 self.assertEqual(component.hwid_type, 'wireless') 756 self.assertEqual(component.hwid_label, test_label) 757 self.assertEqual(component.wifi.pci.vendor_id, test_vendor) 758 self.assertEqual(component.wifi.pci.device_id, test_device) 759 self.assertEqual(component.wifi.pci.revision_id, test_revision) 760 # Should be nothing unparsed 761 self.assertEqual(merger.residual(), {}) 762