@@ -199,6 +199,20 @@ def test_submit_children_and_guardian_can_be_done_only_once(guardian_api_client)
199199 assert "You have already used this mutation." in str (executed ["errors" ])
200200
201201
202+ def test_submit_children_and_guardian_children_limit (user_api_client , settings ):
203+ variables = deepcopy (SUBMIT_CHILDREN_AND_GUARDIAN_VARIABLES )
204+ variables ["input" ]["children" ] = [
205+ variables ["input" ]["children" ][0 ]
206+ for _ in range (settings .KUKKUU_MAX_NUM_OF_CHILDREN_PER_GUARDIAN + 1 )
207+ ]
208+
209+ executed = user_api_client .execute (
210+ SUBMIT_CHILDREN_AND_GUARDIAN_MUTATION , variables = variables ,
211+ )
212+
213+ assert "Too many children." in str (executed ["errors" ])
214+
215+
202216CHILDREN_QUERY = """
203217query Children {
204218 children {
@@ -399,6 +413,19 @@ def test_add_child_mutation_requires_guardian(user_api_client):
399413 assert Child .objects .count () == 0
400414
401415
416+ def test_add_child_mutation_children_limit (guardian_api_client , settings ):
417+ ChildWithGuardianFactory .create_batch (
418+ settings .KUKKUU_MAX_NUM_OF_CHILDREN_PER_GUARDIAN ,
419+ relationship__guardian = guardian_api_client .user .guardian ,
420+ )
421+
422+ executed = guardian_api_client .execute (
423+ ADD_CHILD_MUTATION , variables = ADD_CHILD_VARIABLES
424+ )
425+
426+ assert "Too many children." in str (executed ["errors" ])
427+
428+
402429UPDATE_CHILD_MUTATION = """
403430mutation UpdateChild($input: UpdateChildMutationInput!) {
404431 updateChild(input: $input) {
0 commit comments