Exemple #1
0
    def test_remove_file_no_file(self):
        """Make sure a file which doesn't exist doesn't get removed."""

        s = MockSerial([b"",
                        # Check file existance
                        b"=file.list()['test.txt']\r\n",
                        b"=file.list()['test.txt']\r\nnil\r\n"])
        n = NodeMCU(s)

        with pytest.raises(IOError):
            n.remove_file("test.txt")

        assert s.finished
Exemple #2
0
    def test_remove_file_no_file(self):
        """Make sure a file which doesn't exist doesn't get removed."""

        s = MockSerial([
            b"",
            # Check file existance
            b"=file.list()['test.txt']\r\n",
            b"=file.list()['test.txt']\r\nnil\r\n"
        ])
        n = NodeMCU(s)

        with pytest.raises(IOError):
            n.remove_file("test.txt")

        assert s.finished
Exemple #3
0
    def test_remove_file(self):
        """Remove file should work."""

        s = MockSerial([b"",
                        # Check file existance
                        b"=file.list()['test.txt']\r\n",
                        b"=file.list()['test.txt']\r\n123\r\n",
                        # Remove file
                        b"file.remove('test.txt')\r\n",
                        b"file.remove('test.txt')\r\n"])
        n = NodeMCU(s)

        n.remove_file("test.txt")

        assert s.finished
Exemple #4
0
    def test_remove_file(self):
        """Remove file should work."""

        s = MockSerial([
            b"",
            # Check file existance
            b"=file.list()['test.txt']\r\n",
            b"=file.list()['test.txt']\r\n123\r\n",
            # Remove file
            b"file.remove('test.txt')\r\n",
            b"file.remove('test.txt')\r\n"
        ])
        n = NodeMCU(s)

        n.remove_file("test.txt")

        assert s.finished