Skip to content

Commit 33f7e2e

Browse files
authored
fix hypothesis.HealthCheck.nested_given error (#2232)
1 parent cbc0f4f commit 33f7e2e

File tree

1 file changed

+6
-4
lines changed
  • catalyst-gateway/tests/schemathesis_tests/hooks

1 file changed

+6
-4
lines changed

catalyst-gateway/tests/schemathesis_tests/hooks/hooks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import random
33
import time
44
import os
5-
import hypothesis
5+
from hypothesis import given, strategies as st
66
import cbor2
77

88

@@ -24,10 +24,12 @@ def get(self, case, context):
2424
return 1
2525

2626
def set(self, case, data, context):
27+
self.set_impl(case)
28+
29+
@given(data=st.data())
30+
def set_impl(self, case, data):
2731
security_definitions = case.operation.definition.raw.get("security", [])
28-
# randomly choose what kind of authentication would be applied
29-
choosen_auth_st = hypothesis.strategies.sampled_from(security_definitions)
30-
choosen_auth = hypothesis.find(choosen_auth_st, lambda x: True)
32+
choosen_auth = data.draw(st.sampled_from(security_definitions), label="choosen_auth")
3133
if "NoAuthorization" in choosen_auth:
3234
case.headers.pop("Authorization", None)
3335
case.headers.pop("X-API-Key", None)

0 commit comments

Comments
 (0)