Fix ConnectionField Last Test

This commit is contained in:
= 2017-12-12 12:49:02 -05:00
parent 29935c2d33
commit 616c549d2c

View File

@ -695,8 +695,14 @@ def test_should_query_promise_connectionfields():
assert not result.errors assert not result.errors
assert result.data == expected assert result.data == expected
def test_should_query_promise_connectionfields_with_last(): def test_should_query_connectionfields_with_last():
from promise import Promise
r = Reporter.objects.create(
first_name='John',
last_name='Doe',
email='johndoe@example.com',
a_choice=1
)
class ReporterType(DjangoObjectType): class ReporterType(DjangoObjectType):
@ -708,11 +714,11 @@ def test_should_query_promise_connectionfields_with_last():
all_reporters = DjangoConnectionField(ReporterType) all_reporters = DjangoConnectionField(ReporterType)
def resolve_all_reporters(self, info, **args): def resolve_all_reporters(self, info, **args):
return Promise.resolve([Reporter(id=1)]) return Reporter.objects.all()
schema = graphene.Schema(query=Query) schema = graphene.Schema(query=Query)
query = ''' query = '''
query ReporterPromiseConnectionQuery { query ReporterLastQuery {
allReporters(last: 1) { allReporters(last: 1) {
edges { edges {
node { node {