mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 18:38:14 -04:00
another test
This commit is contained in:
@@ -3,6 +3,8 @@ from unittest.mock import Mock
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
|
from hypothesis import HealthCheck, given, settings
|
||||||
|
from hypothesis import strategies as st
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
|
|
||||||
@@ -275,6 +277,28 @@ def test_post_create_organization_with_missing_data_gives_validation_error(
|
|||||||
assert response["errors"][0]["message"] == expected_error
|
assert response["errors"][0]["message"] == expected_error
|
||||||
|
|
||||||
|
|
||||||
|
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
|
||||||
|
@given(
|
||||||
|
fuzzed_name=st.one_of(st.none(), st.text(min_size=1, max_size=2000)),
|
||||||
|
fuzzed_active=st.one_of(st.none(), st.booleans()),
|
||||||
|
fuzzed_organization_type=st.one_of(st.none, st.sample_from(list(OrganizationType))),
|
||||||
|
)
|
||||||
|
def test_fuzz_post_create_organization_with_missing_data_gives_validation_error(
|
||||||
|
admin_request, fuzzed_name, fuzzed_active, fuzzed_organization_type
|
||||||
|
):
|
||||||
|
data = {
|
||||||
|
"name": fuzzed_name,
|
||||||
|
"active": fuzzed_active,
|
||||||
|
"organization_type": fuzzed_organization_type,
|
||||||
|
}
|
||||||
|
response = admin_request.post(
|
||||||
|
"organization.create_organization", _data=data, _expected_status=400
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(response["errors"]) == 1
|
||||||
|
assert response["errors"][0]["error"] == "ValidationError"
|
||||||
|
|
||||||
|
|
||||||
def test_post_update_organization_updates_fields(
|
def test_post_update_organization_updates_fields(
|
||||||
admin_request,
|
admin_request,
|
||||||
notify_db_session,
|
notify_db_session,
|
||||||
|
|||||||
Reference in New Issue
Block a user