This commit is contained in:
Kenneth Kehl
2025-09-15 11:21:05 -07:00
parent 5faedc7c30
commit 3984d41fa4

View File

@@ -241,6 +241,8 @@ def test_post_create_organization_works(admin_request, sample_organization):
def test_fuzz_create_org_with_edge_cases( def test_fuzz_create_org_with_edge_cases(
admin_request, admin_request,
): ):
list_of_names = []
@settings(max_examples=10) @settings(max_examples=10)
@given( @given(
name=st.one_of(st.none(), st.just(""), st.text(min_size=1, max_size=50)), name=st.one_of(st.none(), st.just(""), st.text(min_size=1, max_size=50)),
@@ -273,13 +275,14 @@ def test_fuzz_create_org_with_edge_cases(
and isinstance(active, bool) and isinstance(active, bool)
} }
expected_status = 201 if is_valid else 400 expected_status = 201 if is_valid else 400
if name not in list_of_names:
try: try:
response = admin_request.post( response = admin_request.post(
"organization.create_organization", "organization.create_organization",
_data=data, _data=data,
_expected_status=expected_status, _expected_status=expected_status,
) )
assert response == "FOO" list_of_names.append(name)
if ( if (
name name
and organization_type is not None and organization_type is not None