
import unittest
from mbed_lstools.lstools_win7 import MbedLsToolsWin7


class Win7TestCase(unittest.TestCase):
    """ Basic test cases checking trivial asserts
    """

    def setUp(self):
        pass

    def test_os_supported(self):
        pass


if __name__ == '__main__':
    unittest.main()


import unittest
from mbed_lstools.lstools_win7 import MbedLsToolsWin7

# Since we don't have mock, let's monkey-patch

def get_mbed_devices_new(self):
    return [
        ('\\DosDevices\\D:', '_??_USBSTOR#Disk&Ven_MBED&Prod_XPRO&Rev_1.00#9&35913356&0&ATML2127031800007973&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}'),
    ]

class Win7TestCase(unittest.TestCase):
    """ Basic test cases checking trivial asserts
    """

    def setUp(self):
        pass

    def test_os_supported(self):
        pass
        
    def test_get_mbeds(self):
        
        m = MbedLsToolsWin7()
        
        func_type = type(MbedLsToolsWin7.get_mbed_devices)
        m.get_mbed_devices = func_type(get_mbed_devices_new, m, MbedLsToolsWin7)

        mbeds = m.get_mbeds()
        
        self.assertIsNotNone(mbeds)
        self.assertEqual(1, len(mbeds))
        
        mbed = mbeds[0]
        
        self.assertEqual("D:", mbed[0])
        self.assertEqual("ATML2127031800007973", mbed[1])
        


if __name__ == '__main__':
    unittest.main()

Add test for mbed parsing
Add test for mbed parsing

  
  import unittest
  from mbed_lstools.lstools_win7 import MbedLsToolsWin7
  
+ # Since we don't have mock, let's monkey-patch
+ 
+ def get_mbed_devices_new(self):
+     return [
+         ('\\DosDevices\\D:', '_??_USBSTOR#Disk&Ven_MBED&Prod_XPRO&Rev_1.00#9&35913356&0&ATML2127031800007973&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}'),
+     ]
  
  class Win7TestCase(unittest.TestCase):
      """ Basic test cases checking trivial asserts
      """
  
      def setUp(self):
          pass
  
      def test_os_supported(self):
          pass
+         
+     def test_get_mbeds(self):
+         
+         m = MbedLsToolsWin7()
+         
+         func_type = type(MbedLsToolsWin7.get_mbed_devices)
+         m.get_mbed_devices = func_type(get_mbed_devices_new, m, MbedLsToolsWin7)
+ 
+         mbeds = m.get_mbeds()
+         
+         self.assertIsNotNone(mbeds)
+         self.assertEqual(1, len(mbeds))
+         
+         mbed = mbeds[0]
+         
+         self.assertEqual("D:", mbed[0])
+         self.assertEqual("ATML2127031800007973", mbed[1])
+         
  
  
  if __name__ == '__main__':
      unittest.main()
  
Add test for mbed parsing
## Code Before:

import unittest
from mbed_lstools.lstools_win7 import MbedLsToolsWin7


class Win7TestCase(unittest.TestCase):
    """ Basic test cases checking trivial asserts
    """

    def setUp(self):
        pass

    def test_os_supported(self):
        pass


if __name__ == '__main__':
    unittest.main()

## Instruction:
Add test for mbed parsing
## Code After:

import unittest
from mbed_lstools.lstools_win7 import MbedLsToolsWin7

# Since we don't have mock, let's monkey-patch

def get_mbed_devices_new(self):
    return [
        ('\\DosDevices\\D:', '_??_USBSTOR#Disk&Ven_MBED&Prod_XPRO&Rev_1.00#9&35913356&0&ATML2127031800007973&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}'),
    ]

class Win7TestCase(unittest.TestCase):
    """ Basic test cases checking trivial asserts
    """

    def setUp(self):
        pass

    def test_os_supported(self):
        pass
        
    def test_get_mbeds(self):
        
        m = MbedLsToolsWin7()
        
        func_type = type(MbedLsToolsWin7.get_mbed_devices)
        m.get_mbed_devices = func_type(get_mbed_devices_new, m, MbedLsToolsWin7)

        mbeds = m.get_mbeds()
        
        self.assertIsNotNone(mbeds)
        self.assertEqual(1, len(mbeds))
        
        mbed = mbeds[0]
        
        self.assertEqual("D:", mbed[0])
        self.assertEqual("ATML2127031800007973", mbed[1])
        


if __name__ == '__main__':
    unittest.main()
