@@ -69,6 +69,27 @@ def test_list_mbeds_valid_platform(self):
69
69
self .assertEqual (to_check [0 ]['target_id' ], "0241BEEFDEAD" )
70
70
self .assertEqual (to_check [0 ]['platform_name' ], 'foo_target' )
71
71
72
+ def test_list_mbeds_invalid_tid (self ):
73
+ self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
74
+ 'target_id_usb_id' : u'0240DEADBEEF' ,
75
+ 'serial_port' : "dummy_serial_port" },
76
+ {'mount_point' : 'dummy_mount_point' ,
77
+ 'target_id_usb_id' : None ,
78
+ 'serial_port' : 'not_valid' }]
79
+ with patch ("mbed_lstools.lstools_base.MbedLsToolsBase._read_htm_ids" ) as _read_htm ,\
80
+ patch ("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready" ) as _mpr ,\
81
+ patch ("mbed_lstools.lstools_base.PlatformDatabase.get" ) as _get :
82
+ _mpr .return_value = True
83
+ _read_htm .side_effect = [(u'0241BEEFDEAD' , {}), (None , {})]
84
+ _get .return_value = 'foo_target'
85
+ to_check = self .base .list_mbeds ()
86
+ _get .assert_called_once_with ('0241' )
87
+ self .assertEqual (len (to_check ), 2 )
88
+ self .assertEqual (to_check [0 ]['target_id' ], "0241BEEFDEAD" )
89
+ self .assertEqual (to_check [0 ]['platform_name' ], 'foo_target' )
90
+ self .assertEqual (to_check [1 ]['target_id' ], None )
91
+ self .assertEqual (to_check [1 ]['platform_name' ], None )
92
+
72
93
def test_list_mbeds_invalid_platform (self ):
73
94
self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
74
95
'target_id_usb_id' : u'not_in_target_db' ,
0 commit comments