mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 09:42:32 +03:00
Add test
This commit is contained in:
parent
234d284dda
commit
d610166a79
|
@ -767,3 +767,55 @@ def test_annotation_is_perserved():
|
||||||
|
|
||||||
assert not result.errors
|
assert not result.errors
|
||||||
assert result.data == expected
|
assert result.data == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_integer_field_filter_type():
|
||||||
|
class PetType(DjangoObjectType):
|
||||||
|
class Meta:
|
||||||
|
model = Pet
|
||||||
|
interfaces = (Node,)
|
||||||
|
filter_fields = {"age": ["exact"]}
|
||||||
|
only_fields = ["age"]
|
||||||
|
|
||||||
|
class Query(ObjectType):
|
||||||
|
pets = DjangoFilterConnectionField(PetType)
|
||||||
|
|
||||||
|
schema = Schema(query=Query)
|
||||||
|
|
||||||
|
assert str(schema) == dedent(
|
||||||
|
"""\
|
||||||
|
schema {
|
||||||
|
query: Query
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Node {
|
||||||
|
id: ID!
|
||||||
|
}
|
||||||
|
|
||||||
|
type PageInfo {
|
||||||
|
hasNextPage: Boolean!
|
||||||
|
hasPreviousPage: Boolean!
|
||||||
|
startCursor: String
|
||||||
|
endCursor: String
|
||||||
|
}
|
||||||
|
|
||||||
|
type PetType implements Node {
|
||||||
|
age: Int!
|
||||||
|
id: ID!
|
||||||
|
}
|
||||||
|
|
||||||
|
type PetTypeConnection {
|
||||||
|
pageInfo: PageInfo!
|
||||||
|
edges: [PetTypeEdge]!
|
||||||
|
}
|
||||||
|
|
||||||
|
type PetTypeEdge {
|
||||||
|
node: PetType
|
||||||
|
cursor: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Query {
|
||||||
|
pets(before: String, after: String, first: Int, last: Int, age: Int): PetTypeConnection
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user