Skip to content

Commit

Permalink
test: add some more trivial fsinfo test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonkarlitskaya committed Jan 26, 2024
1 parent e1bd578 commit a00feeb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/pytest/test_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,16 @@ def fsinfo_test_cases(tmp_path: Path) -> 'dict[Path, JsonObject]':
return expected_state


@pytest.mark.asyncio
async def test_fsinfo_nopath(transport: MockTransport) -> None:
await transport.check_open('fsinfo', attrs=['type'], problem='protocol-error')


@pytest.mark.asyncio
async def test_fsinfo_noattrs(transport: MockTransport) -> None:
await transport.check_open('fsinfo', path='/', problem='protocol-error')


@pytest.mark.asyncio
async def test_fsinfo_relative(transport: MockTransport) -> None:
await transport.check_open('fsinfo', path='rel', problem='protocol-error')
Expand All @@ -781,6 +791,22 @@ async def test_fsinfo_nofollow_watch(transport: MockTransport) -> None:
await transport.check_open('fsinfo', path='/', attrs=[], watch=True, follow=False, problem='protocol-error')


@pytest.mark.asyncio
async def test_fsinfo_nofollow_targets(transport: MockTransport) -> None:
await transport.check_open('fsinfo', path='/', attrs=[], targets='stat', follow=False, problem='protocol-error')


@pytest.mark.asyncio
async def test_fsinfo_empty_update(transport: MockTransport, tmp_path: Path) -> None:
# test an empty update — make sure nothing lands on the wire
ch = await transport.check_open('fsinfo', path=str(tmp_path), attrs=['type'], watch=True)
assert await transport.next_msg(ch) == {'info': {"type": "dir"}}
tmp_path.touch()
await asyncio.sleep(0.1) # fsinfo waits 0.1 before dispatching updates
await transport.assert_empty() # this waits another 0.1
await transport.check_close(ch)


@pytest.mark.asyncio
async def test_fsinfo(transport: MockTransport, fsinfo_test_cases: 'dict[Path, JsonObject]') -> None:
for path, expected_state in fsinfo_test_cases.items():
Expand Down

0 comments on commit a00feeb

Please sign in to comment.