File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1919import unittest
2020from mbed_lstools .lstools_win7 import MbedLsToolsWin7
2121
22+ # Since we don't have mock, let's monkey-patch
23+
24+ def get_mbed_devices_new (self ):
25+ return [
26+ ('\\ DosDevices\\ D:' , '_??_USBSTOR#Disk&Ven_MBED&Prod_XPRO&Rev_1.00#9&35913356&0&ATML2127031800007973&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' ),
27+ ]
2228
2329class Win7TestCase (unittest .TestCase ):
2430 """ Basic test cases checking trivial asserts
@@ -29,6 +35,24 @@ def setUp(self):
2935
3036 def test_os_supported (self ):
3137 pass
38+
39+ def test_get_mbeds (self ):
40+
41+ m = MbedLsToolsWin7 ()
42+
43+ func_type = type (MbedLsToolsWin7 .get_mbed_devices )
44+ m .get_mbed_devices = func_type (get_mbed_devices_new , m , MbedLsToolsWin7 )
45+
46+ mbeds = m .get_mbeds ()
47+
48+ self .assertIsNotNone (mbeds )
49+ self .assertEqual (1 , len (mbeds ))
50+
51+ mbed = mbeds [0 ]
52+
53+ self .assertEqual ("D:" , mbed [0 ])
54+ self .assertEqual ("ATML2127031800007973" , mbed [1 ])
55+
3256
3357
3458if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments