mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-14 05:36:45 +03:00
* test [1293]: regression test print schema with InputObjectType with DateTime field with default_value * chore: clarify test title and assertion --------- Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
This commit is contained in:
parent
03cf2e131e
commit
99f0103e37
41
graphene/tests/issues/test_1293.py
Normal file
41
graphene/tests/issues/test_1293.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# https://github.com/graphql-python/graphene/issues/1293
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
import graphene
|
||||||
|
from graphql.utilities import print_schema
|
||||||
|
|
||||||
|
|
||||||
|
class Filters(graphene.InputObjectType):
|
||||||
|
datetime_after = graphene.DateTime(
|
||||||
|
required=False,
|
||||||
|
default_value=datetime.datetime.utcfromtimestamp(1434549820776 / 1000),
|
||||||
|
)
|
||||||
|
datetime_before = graphene.DateTime(
|
||||||
|
required=False,
|
||||||
|
default_value=datetime.datetime.utcfromtimestamp(1444549820776 / 1000),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SetDatetime(graphene.Mutation):
|
||||||
|
class Arguments:
|
||||||
|
filters = Filters(required=True)
|
||||||
|
|
||||||
|
ok = graphene.Boolean()
|
||||||
|
|
||||||
|
def mutate(root, info, filters):
|
||||||
|
return SetDatetime(ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
class Query(graphene.ObjectType):
|
||||||
|
goodbye = graphene.String()
|
||||||
|
|
||||||
|
|
||||||
|
class Mutations(graphene.ObjectType):
|
||||||
|
set_datetime = SetDatetime.Field()
|
||||||
|
|
||||||
|
|
||||||
|
def test_schema_printable_with_default_datetime_value():
|
||||||
|
schema = graphene.Schema(query=Query, mutation=Mutations)
|
||||||
|
schema_str = print_schema(schema.graphql_schema)
|
||||||
|
assert schema_str, "empty schema printed"
|
Loading…
Reference in New Issue
Block a user