Skip to content

Instantly share code, notes, and snippets.

@keithhackbarth
Last active February 26, 2024 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithhackbarth/808b61ff9e8104f38f8c95effa9422be to your computer and use it in GitHub Desktop.
Save keithhackbarth/808b61ff9e8104f38f8c95effa9422be to your computer and use it in GitHub Desktop.
def test_patch_one_to_many(mutation, fruit, color):
result = mutation(
'{ fruit: updateFruits(data: { id: "1", color: { set: 1 } }) { color { name } } }',
)
> assert not result.errors
E assert not [GraphQLError("Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.", locations=[SourceLocation(line=1, column=12)], path=['fruit'])]
E + where [GraphQLError("Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.", locations=[SourceLocation(line=1, column=12)], path=['fruit'])] = ExecutionResult(data=None, errors=[GraphQLError("Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.", locations=[SourceLocation(line=1, column=12)], path=['fruit'])], extensions={}).errors
tests/mutations/test_relationship.py:30: AssertionError
------------------------------------------------------------------------------------- Captured stderr setup -------------------------------------------------------------------------------------
Creating test database for alias 'default'...
------------------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------------------
ERROR Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.
GraphQL request:1:12
1 | mutation { fruit: updateFruits(data: { id: "1", color: { set: 1 } }) { color { name } } }
| ^
Traceback (most recent call last):
File "/Users/keithhackbarth/Library/Caches/pypoetry/virtualenvs/strawberry-graphql-django-jnF4lNtS-py3.11/lib/python3.11/site-packages/graphql/execution/execute.py", line 540, in execute_field
completed = self.complete_value(
^^^^^^^^^^^^^^^^^^^^
File "/Users/keithhackbarth/Library/Caches/pypoetry/virtualenvs/strawberry-graphql-django-jnF4lNtS-py3.11/lib/python3.11/site-packages/graphql/execution/execute.py", line 612, in complete_value
completed = self.complete_value(
^^^^^^^^^^^^^^^^^^^^
File "/Users/keithhackbarth/Library/Caches/pypoetry/virtualenvs/strawberry-graphql-django-jnF4lNtS-py3.11/lib/python3.11/site-packages/graphql/execution/execute.py", line 632, in complete_value
return self.complete_list_value(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/keithhackbarth/Library/Caches/pypoetry/virtualenvs/strawberry-graphql-django-jnF4lNtS-py3.11/lib/python3.11/site-packages/graphql/execution/execute.py", line 686, in complete_list_value
raise GraphQLError(
graphql.error.graphql_error.GraphQLError: Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment