()
| 268 | |
| 269 | |
| 270 | def test_resolve(): |
| 271 | v = view.View() |
| 272 | with taddons.context() as tctx: |
| 273 | f = tft(method="get") |
| 274 | assert tctx.command(v.resolve, "@all") == [] |
| 275 | assert tctx.command(v.resolve, "@focus") == [] |
| 276 | assert tctx.command(v.resolve, "@shown") == [] |
| 277 | assert tctx.command(v.resolve, "@hidden") == [] |
| 278 | assert tctx.command(v.resolve, "@marked") == [] |
| 279 | assert tctx.command(v.resolve, "@unmarked") == [] |
| 280 | assert tctx.command(v.resolve, f"@{f.id}") == [] |
| 281 | assert tctx.command(v.resolve, "~m get") == [] |
| 282 | v.requestheaders(f) |
| 283 | assert len(tctx.command(v.resolve, "~m get")) == 1 |
| 284 | assert len(tctx.command(v.resolve, "@focus")) == 1 |
| 285 | assert len(tctx.command(v.resolve, "@all")) == 1 |
| 286 | assert len(tctx.command(v.resolve, "@shown")) == 1 |
| 287 | assert len(tctx.command(v.resolve, "@unmarked")) == 1 |
| 288 | assert len(tctx.command(v.resolve, f"@{f.id}")) == 1 |
| 289 | assert tctx.command(v.resolve, "@hidden") == [] |
| 290 | assert tctx.command(v.resolve, "@marked") == [] |
| 291 | v.requestheaders(tft(method="put")) |
| 292 | assert len(tctx.command(v.resolve, f"@{f.id}")) == 1 |
| 293 | assert len(tctx.command(v.resolve, "@focus")) == 1 |
| 294 | assert len(tctx.command(v.resolve, "@shown")) == 2 |
| 295 | assert len(tctx.command(v.resolve, "@all")) == 2 |
| 296 | assert tctx.command(v.resolve, "@hidden") == [] |
| 297 | assert tctx.command(v.resolve, "@marked") == [] |
| 298 | |
| 299 | v.requestheaders(tft(method="get")) |
| 300 | v.requestheaders(tft(method="put")) |
| 301 | |
| 302 | f = flowfilter.parse("~m get") |
| 303 | v.set_filter(f) |
| 304 | v[0].marked = True |
| 305 | |
| 306 | def methods(flows): |
| 307 | return [i.request.method for i in flows] |
| 308 | |
| 309 | assert methods(tctx.command(v.resolve, "~m get")) == ["GET", "GET"] |
| 310 | assert methods(tctx.command(v.resolve, "~m put")) == ["PUT", "PUT"] |
| 311 | assert methods(tctx.command(v.resolve, "@shown")) == ["GET", "GET"] |
| 312 | assert methods(tctx.command(v.resolve, "@hidden")) == ["PUT", "PUT"] |
| 313 | assert methods(tctx.command(v.resolve, "@marked")) == ["GET"] |
| 314 | assert methods(tctx.command(v.resolve, "@unmarked")) == ["PUT", "GET", "PUT"] |
| 315 | assert methods(tctx.command(v.resolve, "@all")) == ["GET", "PUT", "GET", "PUT"] |
| 316 | |
| 317 | with pytest.raises(exceptions.CommandError, match="Invalid filter expression"): |
| 318 | tctx.command(v.resolve, "~") |
| 319 | |
| 320 | |
| 321 | def test_movement(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…