Skip to content

Commit

Permalink
wip more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odesenfans committed Sep 16, 2023
1 parent b0629dc commit 1a7ab1c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/executor/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,29 @@ async def test_call_publish_twice(

@pytest.mark.asyncio
async def test_call_generate_twice(
mock_ccn_client: aiohttp.ClientSession,
executor_client: aiohttp.ClientSession,
published_vrf_request: Tuple[MessageDict, VRFRequest],
):
"""
Test that calling POST /generate twice with the same request does not generate a new random number.
We expect the API to return the same random number.
"""
...
message_dict, vrf_request = published_vrf_request
item_hash = message_dict["item_hash"]

# Call POST /generate a first time
resp = await executor_client.post(f"/generate/{item_hash}")
assert resp.status == 200, await resp.text()
response_json = await resp.json()
first_response_hash = VRFResponseHash.parse_obj(response_json["data"])

# Call POST /generate a second time
resp = await executor_client.post(f"/generate/{item_hash}")
assert resp.status == 200, await resp.text()
response_json = await resp.json()
second_response_hash = VRFResponseHash.parse_obj(response_json["data"])

assert_vrf_response_hash_equal(second_response_hash, first_response_hash)


@pytest.mark.asyncio
Expand Down

0 comments on commit 1a7ab1c

Please sign in to comment.