(tmpdir, caplog)
| 250 | |
| 251 | |
| 252 | async def test_load(tmpdir, caplog): |
| 253 | path = str(tmpdir.join("path")) |
| 254 | v = view.View() |
| 255 | tdump(path, [tflow.tflow(resp=True), tflow.tflow(resp=True)]) |
| 256 | v.load_file(path) |
| 257 | assert len(v) == 2 |
| 258 | v.load_file(path) |
| 259 | assert len(v) == 4 |
| 260 | try: |
| 261 | v.load_file("nonexistent_file_path") |
| 262 | except OSError: |
| 263 | assert False |
| 264 | with open(path, "wb") as f: |
| 265 | f.write(b"invalidflows") |
| 266 | v.load_file(path) |
| 267 | assert "Invalid data format." in caplog.text |
| 268 | |
| 269 | |
| 270 | def test_resolve(): |