コード例 #1
0
    def test_gets_file(self, tmpdir):
        with open(str(tmpdir.join("file.txt")), "wb") as fp:
            fp.write(b"my test file contents")

        storage = LocalFileStorage(str(tmpdir))
        file_object = storage.get("file.txt")
        assert file_object.read() == b"my test file contents"
コード例 #2
0
 def test_raises_when_file_non_existant(self, tmpdir):
     storage = LocalFileStorage(str(tmpdir))
     with pytest.raises(FileNotFoundError):
         storage.get("file.txt")