def test_list_files_with_no_files(self): """Special case: list files when none present""" s = MockSerial([b"", # Get file count self.COUNT_FILES_SNIPPET + b"\r\n", self.COUNT_FILES_SNIPPET + b"\r\n0\r\n", # Enumerate file info self.LIST_FILES_SNIPPET + b"\r\n", self.LIST_FILES_SNIPPET + b"\r\n"]) n = NodeMCU(s) assert n.list_files() == {} assert s.finished
def test_list_files_with_no_files(self): """Special case: list files when none present""" s = MockSerial([ b"", # Get file count self.COUNT_FILES_SNIPPET + b"\r\n", self.COUNT_FILES_SNIPPET + b"\r\n0\r\n", # Enumerate file info self.LIST_FILES_SNIPPET + b"\r\n", self.LIST_FILES_SNIPPET + b"\r\n" ]) n = NodeMCU(s) assert n.list_files() == {} assert s.finished
def test_list_files(self): """Should send a suitable file-listing command.""" s = MockSerial([b"", # Get file count self.COUNT_FILES_SNIPPET + b"\r\n", self.COUNT_FILES_SNIPPET + b"\r\n2\r\n", # Enumerate file info self.LIST_FILES_SNIPPET + b"\r\n", self.LIST_FILES_SNIPPET + b"\r\n" + b"7\r\nfoo.txt123\r\n" b"5\r\n\t.tab0\r\n"]) n = NodeMCU(s) assert n.list_files() == { "foo.txt": 123, "\t.tab": 0, } assert s.finished
def test_list_files(self): """Should send a suitable file-listing command.""" s = MockSerial([ b"", # Get file count self.COUNT_FILES_SNIPPET + b"\r\n", self.COUNT_FILES_SNIPPET + b"\r\n2\r\n", # Enumerate file info self.LIST_FILES_SNIPPET + b"\r\n", self.LIST_FILES_SNIPPET + b"\r\n" + b"7\r\nfoo.txt123\r\n" b"5\r\n\t.tab0\r\n" ]) n = NodeMCU(s) assert n.list_files() == { "foo.txt": 123, "\t.tab": 0, } assert s.finished