Exemple #1
0
    def test_send_command(self, prompt, response):
        """Make sure commands are sent and the echo-back absorbed."""
        s = MockSerial([
            b"",  # Nothing to read in buffer
            b"foo()\r\n",  # Command should be sent
            (prompt + b"foo()\r\n" + response)
        ])  # Echo-back and response
        n = NodeMCU(s)

        n.send_command(b"foo()")

        # Should have sent the command as expected
        assert len(s.expected_sequence) == 1

        # Should have read in the echo-back but left the response
        assert s.expected_sequence[0] == response
Exemple #2
0
    def test_send_command(self, prompt, response):
        """Make sure commands are sent and the echo-back absorbed."""
        s = MockSerial([b"",           # Nothing to read in buffer
                        b"foo()\r\n",  # Command should be sent
                        (prompt +
                         b"foo()\r\n" +
                         response)])   # Echo-back and response
        n = NodeMCU(s)

        n.send_command(b"foo()")

        # Should have sent the command as expected
        assert len(s.expected_sequence) == 1

        # Should have read in the echo-back but left the response
        assert s.expected_sequence[0] == response