mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-01-31 11:48:38 +03:00
Test Last works
This commit is contained in:
parent
de59d26968
commit
29935c2d33
|
@ -695,6 +695,48 @@ def test_should_query_promise_connectionfields():
|
|||
assert not result.errors
|
||||
assert result.data == expected
|
||||
|
||||
def test_should_query_promise_connectionfields_with_last():
|
||||
from promise import Promise
|
||||
|
||||
class ReporterType(DjangoObjectType):
|
||||
|
||||
class Meta:
|
||||
model = Reporter
|
||||
interfaces = (Node, )
|
||||
|
||||
class Query(graphene.ObjectType):
|
||||
all_reporters = DjangoConnectionField(ReporterType)
|
||||
|
||||
def resolve_all_reporters(self, info, **args):
|
||||
return Promise.resolve([Reporter(id=1)])
|
||||
|
||||
schema = graphene.Schema(query=Query)
|
||||
query = '''
|
||||
query ReporterPromiseConnectionQuery {
|
||||
allReporters(last: 1) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
expected = {
|
||||
'allReporters': {
|
||||
'edges': [{
|
||||
'node': {
|
||||
'id': 'UmVwb3J0ZXJUeXBlOjE='
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
result = schema.execute(query)
|
||||
assert not result.errors
|
||||
assert result.data == expected
|
||||
|
||||
|
||||
def test_should_query_dataloader_fields():
|
||||
from promise import Promise
|
||||
|
|
Loading…
Reference in New Issue
Block a user