Skip to content

Commit

Permalink
Fix: Sanity check on test was not working (#7)
Browse files Browse the repository at this point in the history
Problem: the way to check if a fixture was called is
`fixture.assert_called_once()` and not `assert fixture.called_once()`.
  • Loading branch information
odesenfans authored Sep 22, 2023
1 parent e833fab commit d700dde
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/coordinator/test_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ async def test_select_random_nodes(fixture_nodes_aggregate: Dict[str, Any], mock
return_value=fixture_nodes_aggregate,
)

# Sanity check, avoid network accesses
assert network_fixture.called_once

nodes = await select_random_nodes(3, [])
# Sanity check, avoid network accesses
network_fixture.assert_called_once()
assert len(nodes) == 3

with pytest.raises(ValueError) as exception:
Expand All @@ -163,10 +162,9 @@ async def test_select_random_nodes_with_unauthorized(fixture_nodes_aggregate: Di
return_value=fixture_nodes_aggregate,
)

# Sanity check, avoid network accesses
assert network_fixture.called_once

nodes = await select_random_nodes(3, ["https://aleph2.serverrg.eu"])
# Sanity check, avoid network accesses
network_fixture.assert_called_once()
assert len(nodes) == 3

with pytest.raises(ValueError) as exception:
Expand All @@ -178,4 +176,3 @@ async def test_select_random_nodes_with_unauthorized(fixture_nodes_aggregate: Di
str(exception.value)
== f"Not enough CRNs linked, only 3 available from 4 requested"
)

0 comments on commit d700dde

Please sign in to comment.