Exemple #1
0
    def test_restart(self):
        """Should be able to restart, absorbing any garbage."""

        s = MockSerial([b"",
                        # Send restart command, get echoback, a prompt and
                        # some garbage
                        b"node.restart()\r\n",
                        (b"node.restart()\r\n"
                         b"> "
                         b"\xDE\xAD\xBE\xEF\xFF"  # Garbage
                         b"\r\n\r\n"
                         b"NodeMCU [some version]\r\n"  # Banner
                         b"        some info: here\r\n"
                         b" build built on: 1990-12-11 19:56\r\n"
                         b" powered by Lua 5.1.4 on SDK 1.4.0\r\n"
                         b"> ")])
        n = NodeMCU(s)

        n.restart()

        assert s.finished
Exemple #2
0
    def test_restart(self):
        """Should be able to restart, absorbing any garbage."""

        s = MockSerial([
            b"",
            # Send restart command, get echoback, a prompt and
            # some garbage
            b"node.restart()\r\n",
            (
                b"node.restart()\r\n"
                b"> "
                b"\xDE\xAD\xBE\xEF\xFF"  # Garbage
                b"\r\n\r\n"
                b"NodeMCU [some version]\r\n"  # Banner
                b"        some info: here\r\n"
                b" build built on: 1990-12-11 19:56\r\n"
                b" powered by Lua 5.1.4 on SDK 1.4.0\r\n"
                b"> ")
        ])
        n = NodeMCU(s)

        n.restart()

        assert s.finished