Skip to content

Commit 5532e89

Browse files
committed
Add test
1 parent 93deecf commit 5532e89

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

graphene_django/filter/tests/test_fields.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,3 +765,55 @@ def resolve_all_reporters(self, info, **args):
765765

766766
assert not result.errors
767767
assert result.data == expected
768+
769+
770+
def test_integer_field_filter_type():
771+
class PetType(DjangoObjectType):
772+
class Meta:
773+
model = Pet
774+
interfaces = (Node,)
775+
filter_fields = {"age": ["exact"]}
776+
only_fields = ["age"]
777+
778+
class Query(ObjectType):
779+
pets = DjangoFilterConnectionField(PetType)
780+
781+
schema = Schema(query=Query)
782+
783+
assert str(schema) == dedent(
784+
"""\
785+
schema {
786+
query: Query
787+
}
788+
789+
interface Node {
790+
id: ID!
791+
}
792+
793+
type PageInfo {
794+
hasNextPage: Boolean!
795+
hasPreviousPage: Boolean!
796+
startCursor: String
797+
endCursor: String
798+
}
799+
800+
type PetType implements Node {
801+
age: Int!
802+
id: ID!
803+
}
804+
805+
type PetTypeConnection {
806+
pageInfo: PageInfo!
807+
edges: [PetTypeEdge]!
808+
}
809+
810+
type PetTypeEdge {
811+
node: PetType
812+
cursor: String!
813+
}
814+
815+
type Query {
816+
pets(before: String, after: String, first: Int, last: Int, age: Int): PetTypeConnection
817+
}
818+
"""
819+
)

0 commit comments

Comments
 (0)