Skip to content

Commit d610166

Browse files
committed
Add test
1 parent 234d284 commit d610166

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
@@ -767,3 +767,55 @@ def resolve_all_reporters(self, info, **args):
767767

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

0 commit comments

Comments
 (0)