2
0

test_peripheral_hand.py 1009 B

12345678910111213141516171819202122232425262728293031323334
  1. import unittest
  2. import time
  3. from device.fubo_pneumatic_finger import FuboPneumaticFingerClient, get_serial_ports
  4. PORT = "COM3"
  5. init_params = {"port": PORT}
  6. class TestPeripheralHand(unittest.TestCase):
  7. def test_get_ports_from_computer_success(self):
  8. ports = get_serial_ports()
  9. self.assertTrue(len(ports) > 0)
  10. def test_client_init_success(self):
  11. client = FuboPneumaticFingerClient(init_params)
  12. self.assertTrue(client.is_connected)
  13. client.close()
  14. def test_client_close_success(self):
  15. client = FuboPneumaticFingerClient(init_params)
  16. client.close()
  17. self.assertFalse(client.is_connected)
  18. def test_start_extend_success(self):
  19. client = FuboPneumaticFingerClient(init_params)
  20. client.start('extend')
  21. time.sleep(3)
  22. client.close()
  23. def test_start_operate_success(self):
  24. client = FuboPneumaticFingerClient(init_params)
  25. client.start('flex')
  26. time.sleep(3)
  27. client.close()