Skip to content

Commit 616c549

Browse files
author
=
committed
Fix ConnectionField Last Test
1 parent 29935c2 commit 616c549

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

graphene_django/tests/test_query.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class Query(graphene.ObjectType):
667667

668668
def resolve_all_reporters(self, info, **args):
669669
return Promise.resolve([Reporter(id=1)])
670-
670+
671671
schema = graphene.Schema(query=Query)
672672
query = '''
673673
query ReporterPromiseConnectionQuery {
@@ -695,8 +695,14 @@ def resolve_all_reporters(self, info, **args):
695695
assert not result.errors
696696
assert result.data == expected
697697

698-
def test_should_query_promise_connectionfields_with_last():
699-
from promise import Promise
698+
def test_should_query_connectionfields_with_last():
699+
700+
r = Reporter.objects.create(
701+
first_name='John',
702+
last_name='Doe',
703+
email='johndoe@example.com',
704+
a_choice=1
705+
)
700706

701707
class ReporterType(DjangoObjectType):
702708

@@ -708,11 +714,11 @@ class Query(graphene.ObjectType):
708714
all_reporters = DjangoConnectionField(ReporterType)
709715

710716
def resolve_all_reporters(self, info, **args):
711-
return Promise.resolve([Reporter(id=1)])
712-
717+
return Reporter.objects.all()
718+
713719
schema = graphene.Schema(query=Query)
714720
query = '''
715-
query ReporterPromiseConnectionQuery {
721+
query ReporterLastQuery {
716722
allReporters(last: 1) {
717723
edges {
718724
node {

0 commit comments

Comments
 (0)