mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-13 16:52:23 -05:00
debug
This commit is contained in:
@@ -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,25 +275,26 @@ 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
|
||||||
try:
|
if name not in list_of_names:
|
||||||
response = admin_request.post(
|
try:
|
||||||
"organization.create_organization",
|
response = admin_request.post(
|
||||||
_data=data,
|
"organization.create_organization",
|
||||||
_expected_status=expected_status,
|
_data=data,
|
||||||
)
|
_expected_status=expected_status,
|
||||||
assert response == "FOO"
|
)
|
||||||
if (
|
list_of_names.append(name)
|
||||||
name
|
if (
|
||||||
and organization_type is not None
|
name
|
||||||
and isinstance(organization_type, OrganizationType)
|
and organization_type is not None
|
||||||
):
|
and isinstance(organization_type, OrganizationType)
|
||||||
assert response.status_code == 201
|
):
|
||||||
assert len(_get_organizations()) == initial_count + 1
|
assert response.status_code == 201
|
||||||
else:
|
assert len(_get_organizations()) == initial_count + 1
|
||||||
assert response.status_code in (400, 422)
|
else:
|
||||||
assert len(_get_organizations()) == initial_count
|
assert response.status_code in (400, 422)
|
||||||
except Exception as e:
|
assert len(_get_organizations()) == initial_count
|
||||||
pytest.fail(f"Unexpected error durring fuzz test: {e}")
|
except Exception as e:
|
||||||
|
pytest.fail(f"Unexpected error durring fuzz test: {e}")
|
||||||
|
|
||||||
inner()
|
inner()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user