@@ -280,14 +280,8 @@ def test_update_device_from_fs_mid_unmount(self):
280
280
with patch ('os.listdir' ) as _listdir :
281
281
_listdir .side_effect = OSError
282
282
self .base ._update_device_from_fs (device , False )
283
- self .assertEqual (device ['device_type' ], 'unknown' )
284
283
self .assertEqual (device ['mount_point' ], None )
285
284
286
- def test_update_device_from_fs_unknown (self ):
287
- device = {}
288
- self .base ._update_device_from_fs (device , False )
289
- self .assertEqual (device ['device_type' ], 'unknown' )
290
-
291
285
def test_detect_device_test (self ):
292
286
device_type = self .base ._detect_device_type ({
293
287
'vendor_id' : '0483'
@@ -304,6 +298,25 @@ def test_detect_device_test(self):
304
298
})
305
299
self .assertEqual (device_type , 'jlink' )
306
300
301
+ def test_device_type_unmounted (self ):
302
+ self .base .list_unmounted = True
303
+ self .base .return_value = [{'mount_point' : None ,
304
+ 'target_id_usb_id' : u'0240DEADBEEF' ,
305
+ 'serial_port' : "dummy_serial_port" ,
306
+ 'vendor_id' : '0d28' ,
307
+ 'product_id' : '0204' }]
308
+ with patch ("mbed_lstools.lstools_base.PlatformDatabase.get" ) as _get ,\
309
+ patch ('os.listdir' ) as _listdir :
310
+ _get .return_value = {
311
+ 'platform_name' : 'foo_target'
312
+ }
313
+ to_check = self .base .list_mbeds ()
314
+ #_get.assert_any_call('0240', device_type='daplink', verbose_data=True)
315
+ self .assertEqual (len (to_check ), 1 )
316
+ self .assertEqual (to_check [0 ]['target_id' ], "0240DEADBEEF" )
317
+ self .assertEqual (to_check [0 ]['platform_name' ], 'foo_target' )
318
+ self .assertEqual (to_check [0 ]['device_type' ], 'daplink' )
319
+
307
320
def test_update_device_details_jlink (self ):
308
321
jlink_html_contents = ('<html><head><meta http-equiv="refresh" '
309
322
'content="0; url=http://www.nxp.com/FRDM-KL27Z"/>'
0 commit comments