@@ -136,6 +136,31 @@ def setUp(self):
136
136
"/dev/sdf on /media/usb4 type vfat (rw,noexec,nodev,sync,noatime,nodiratime,gid=1000,uid=1000,dmask=000,fmask=000)"
137
137
]
138
138
139
+ self .disk_list_3 = [
140
+ "total 0" ,
141
+ "lrwxrwxrwx 1 root 13 Jan 5 09:41 usb-MBED_MBED_CMSIS-DAP_0240020152986E5EAF6693E6-if01 -> ../../ttyACM0" ,
142
+ "lrwxrwxrwx 1 root 13 Jan 5 10:00 usb-MBED_MBED_CMSIS-DAP_0240020152A06E54AF5E93EC-if01 -> ../../ttyACM3" ,
143
+ "lrwxrwxrwx 1 root 13 Jan 5 10:00 usb-MBED_MBED_CMSIS-DAP_107002001FE6E019E2190F91-if01 -> ../../ttyACM1" ,
144
+ "lrwxrwxrwx 1 root 13 Jan 5 10:00 usb-STMicroelectronics_STM32_STLink_0672FF485649785087171742-if02 -> ../../ttyACM2" ,
145
+ ]
146
+
147
+ self .serial_list_3 = [
148
+ "total 0" ,
149
+ "lrwxrwxrwx 1 root 9 Dec 11 14:18 ata-HDS728080PLA380_40Y9028LEN_PFDB32S7S44XLM -> ../../sda" ,
150
+ "lrwxrwxrwx 1 root 10 Dec 11 14:18 ata-HDS728080PLA380_40Y9028LEN_PFDB32S7S44XLM-part1 -> ../../sda1" ,
151
+ "lrwxrwxrwx 1 root 10 Dec 11 14:18 ata-HDS728080PLA380_40Y9028LEN_PFDB32S7S44XLM-part2 -> ../../sda2" ,
152
+ "lrwxrwxrwx 1 root 10 Dec 11 14:18 ata-HDS728080PLA380_40Y9028LEN_PFDB32S7S44XLM-part5 -> ../../sda5" ,
153
+ "lrwxrwxrwx 1 root 9 Dec 11 14:18 ata-TSSTcorpDVD-ROM_TS-H352C -> ../../sr0" ,
154
+ "lrwxrwxrwx 1 root 9 Jan 5 09:41 usb-MBED_microcontroller_0240020152986E5EAF6693E6-0:0 -> ../../sdb" ,
155
+ "lrwxrwxrwx 1 root 9 Jan 5 10:00 usb-MBED_microcontroller_0240020152A06E54AF5E93EC-0:0 -> ../../sde" ,
156
+ "lrwxrwxrwx 1 root 9 Jan 5 10:00 usb-MBED_microcontroller_0672FF485649785087171742-0:0 -> ../../sdd" ,
157
+ "lrwxrwxrwx 1 root 9 Jan 5 10:00 usb-MBED_microcontroller_107002001FE6E019E2190F91-0:0 -> ../../sdc" ,
158
+ "lrwxrwxrwx 1 root 9 Dec 11 14:18 wwn-0x5000cca30ccffb77 -> ../../sda" ,
159
+ "lrwxrwxrwx 1 root 10 Dec 11 14:18 wwn-0x5000cca30ccffb77-part1 -> ../../sda1" ,
160
+ "lrwxrwxrwx 1 root 10 Dec 11 14:18 wwn-0x5000cca30ccffb77-part2 -> ../../sda2" ,
161
+ "lrwxrwxrwx 1 root 10 Dec 11 14:18 wwn-0x5000cca30ccffb77-part5 -> ../../sda5" ,
162
+ ]
163
+
139
164
def tearDown (self ):
140
165
pass
141
166
@@ -292,5 +317,27 @@ def test_get_disk_hex_ids_2(self):
292
317
self .assertIn ("usb-MBED_microcontroller_02400201489A1E6CB564E3D4-0:0 -> ../../sde" , hex_values )
293
318
self .assertIn ("usb-MBED_microcontroller_0240020152986E5EAF6693E6-0:0 -> ../../sdb" , hex_values )
294
319
320
+ def test_get_dev_by_id_process_ret_0 (self ):
321
+ id_disks = self .linux_generic .get_dev_by_id_process (self .disk_list_3 , 0 )
322
+ id_serial = self .linux_generic .get_dev_by_id_process (self .serial_list_3 , 0 )
323
+
324
+ self .assertEqual (4 , len (id_disks ))
325
+ self .assertEqual (13 , len (id_serial ))
326
+ self .assertNotIn ("total 0" , id_disks )
327
+ self .assertNotIn ("Total 0" , id_disks )
328
+ self .assertNotIn ("total 0" , id_serial )
329
+ self .assertNotIn ("Total 0" , id_serial )
330
+
331
+ def test_get_dev_by_id_process_ret_non_zero (self ):
332
+ id_disks = self .linux_generic .get_dev_by_id_process (self .disk_list_3 , - 1 )
333
+ id_serial = self .linux_generic .get_dev_by_id_process (self .serial_list_3 , - 1 )
334
+
335
+ self .assertEqual ([], id_disks )
336
+ self .assertEqual ([], id_serial )
337
+
338
+ def test_ (self ):
339
+ pass
340
+
341
+
295
342
if __name__ == '__main__' :
296
343
unittest .main ()
0 commit comments