def test_connect_normal_hanshake_noauth(self):
        driver = ExampleArduinoDriver(do_hanshake=True, do_authentification=False, connection_timeout=0)
        yield driver.connect(port=self.ports[0], connection_mode=1)

        self.assertTrue(driver.is_connected)
        driver.disconnect()
        self.assertFalse(driver.is_connected)
    def test_call_get_hardware_id(self):
        driver = ExampleArduinoDriver(hardware_id="72442ba3-058c-4cee-a060-5d7c644f1dbe", do_hanshake=True, do_authentification=True, connection_timeout=0)
        yield driver.connect(port=self.ports[0], connection_mode=1)

        exp_response = "72442ba3-058c-4cee-a060-5d7c644f1dbe"
        obs_response = yield driver.get_hardware_id()
        self.assertEquals(obs_response, exp_response)
        driver.disconnect()
 def test_connect_setup_hanshake_auth(self):
     driver = ExampleArduinoDriver(do_hanshake=True, do_authentification=True, connection_timeout=0)
     yield driver.connect(port=self.ports[0], connection_mode=0)
     self.assertTrue(driver.is_connected)
     driver.disconnect()
     self.assertFalse(driver.is_connected)
     self.assertTrue(driver.is_configured)
     self.assertEquals(driver.hardware_id, "72442ba3-058c-4cee-a060-5d7c644f1dbe")
    def test_connect_normal_hanshake_noauth(self):
        driver = ExampleArduinoDriver(do_hanshake=True,
                                      do_authentification=False,
                                      connection_timeout=0)
        yield driver.connect(port=self.ports[0], connection_mode=1)

        self.assertTrue(driver.is_connected)
        driver.disconnect()
        self.assertFalse(driver.is_connected)
    def test_connect_normal_hanshake_auth(self):
        driver = ExampleArduinoDriver(
            hardware_id="72442ba3-058c-4cee-a060-5d7c644f1dbe",
            do_hanshake=True,
            do_authentification=True,
            connection_timeout=0)
        yield driver.connect(port=self.ports[0], connection_mode=1)

        self.assertTrue(driver.is_connected)
        driver.disconnect()
        self.assertFalse(driver.is_connected)
    def test_connect_normal_hanshake_auth_timeout(self):
        driver = ExampleArduinoDriver(
            hardware_id="72442ba3-058c-4cee-a060-5d7c644f1dbe",
            do_hanshake=True,
            do_authentification=True,
            connection_timeout=2,
        )
        yield driver.connect(port=self.ports[0], connection_mode=1)

        self.assertTrue(driver.is_connected)
        driver.disconnect()
        self.assertFalse(driver.is_connected)
示例#7
0
    def test_call_get_hardware_id(self):
        driver = ExampleArduinoDriver(
            hardware_id="72442ba3-058c-4cee-a060-5d7c644f1dbe",
            do_hanshake=True,
            do_authentification=True,
            connection_timeout=0)
        yield driver.connect(port=self.ports[0], connection_mode=1)

        exp_response = "72442ba3-058c-4cee-a060-5d7c644f1dbe"
        obs_response = yield driver.get_hardware_id()
        self.assertEquals(obs_response, exp_response)
        driver.disconnect()
 def test_connect_normal_hanshake_auth_timeout_failure(self):
     driver = ExampleArduinoDriver(do_hanshake=True, do_authentification=True, connection_timeout=0.2)
     deferred = driver.connect(port=self.ports[0], connection_mode=1)
     return self.assertFailure(deferred, TimeoutError)
 def test_connect_normal_hanshake_auth_timeout_failure(self):
     driver = ExampleArduinoDriver(do_hanshake=True,
                                   do_authentification=True,
                                   connection_timeout=0.2)
     deferred = driver.connect(port=self.ports[0], connection_mode=1)
     return self.assertFailure(deferred, TimeoutError)