|
3 | 3 | import graphene
|
4 | 4 |
|
5 | 5 | from .fixtures import setup_fixtures
|
6 |
| -from .models import Article, Editor, Player, Reporter |
7 |
| -from .types import (ArticleNode, ArticleType, |
8 |
| - EditorNode, EditorType, |
9 |
| - PlayerNode, PlayerType, |
10 |
| - ReporterNode, ReporterType) |
11 |
| -from ..fields import MongoengineConnectionField |
| 6 | +from .models import Editor, Player, Reporter |
| 7 | +from .types import (EditorType, |
| 8 | + PlayerType, |
| 9 | + ReporterType) |
12 | 10 |
|
13 | 11 | setup_fixtures()
|
14 | 12 |
|
15 | 13 |
|
16 | 14 | def test_should_query_editor():
|
17 | 15 |
|
18 | 16 | class Query(graphene.ObjectType):
|
19 |
| - editor = graphene.Field(EditorType) |
20 |
| - editors = graphene.List(EditorType) |
21 | 17 |
|
22 |
| - def resolve_editor(self, *args, **kwargs): |
23 |
| - return Editor.objects.first() |
| 18 | + editor = graphene.Field(EditorType) |
| 19 | + editors = graphene.List(EditorType) |
24 | 20 |
|
25 |
| - def resolve_editors(self, *args, **kwargs): |
26 |
| - return list(Editor.objects.all()) |
| 21 | + def resolve_editor(self, *args, **kwargs): |
| 22 | + return Editor.objects.first() |
| 23 | + |
| 24 | + def resolve_editors(self, *args, **kwargs): |
| 25 | + return list(Editor.objects.all()) |
27 | 26 |
|
28 | 27 | query = '''
|
29 | 28 | query EditorQuery {
|
@@ -147,7 +146,7 @@ def resolve_editors(self, *args, **kwargs):
|
147 | 146 | }
|
148 | 147 | '''
|
149 | 148 | expected = {
|
150 |
| - 'editors':[ |
| 149 | + 'editors': [ |
151 | 150 | {
|
152 | 151 | 'firstName': 'Penny',
|
153 | 152 | 'lastName': 'Hardaway'
|
|
0 commit comments