Skip to content

Commit e056adf

Browse files
committed
Add explicit fields = "__all__" to mute warnings in tests
1 parent 51cbae3 commit e056adf

File tree

9 files changed

+75
-1
lines changed

9 files changed

+75
-1
lines changed

graphene_django/debug/tests/test_query.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ReporterType(DjangoObjectType):
2222
class Meta:
2323
model = Reporter
2424
interfaces = (Node,)
25+
fields = "__all__"
2526

2627
class Query(graphene.ObjectType):
2728
reporter = graphene.Field(ReporterType)
@@ -71,6 +72,7 @@ class ReporterType(DjangoObjectType):
7172
class Meta:
7273
model = Reporter
7374
interfaces = (Node,)
75+
fields = "__all__"
7476

7577
class Query(graphene.ObjectType):
7678
reporter = graphene.Field(ReporterType)
@@ -143,6 +145,7 @@ class ReporterType(DjangoObjectType):
143145
class Meta:
144146
model = Reporter
145147
interfaces = (Node,)
148+
fields = "__all__"
146149

147150
class Query(graphene.ObjectType):
148151
all_reporters = graphene.List(ReporterType)
@@ -188,6 +191,7 @@ class ReporterType(DjangoObjectType):
188191
class Meta:
189192
model = Reporter
190193
interfaces = (Node,)
194+
fields = "__all__"
191195

192196
class Query(graphene.ObjectType):
193197
all_reporters = DjangoConnectionField(ReporterType)
@@ -246,6 +250,7 @@ class ReporterType(DjangoObjectType):
246250
class Meta:
247251
model = Reporter
248252
interfaces = (Node,)
253+
fields = "__all__"
249254

250255
class Query(graphene.ObjectType):
251256
all_reporters = DjangoFilterConnectionField(ReporterType, fields=["last_name"])

graphene_django/filter/tests/test_fields.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,20 @@ class ArticleNode(DjangoObjectType):
4141
class Meta:
4242
model = Article
4343
interfaces = (Node,)
44+
fields = "__all__"
4445
filter_fields = ("headline",)
4546

4647
class ReporterNode(DjangoObjectType):
4748
class Meta:
4849
model = Reporter
4950
interfaces = (Node,)
51+
fields = "__all__"
5052

5153
class PetNode(DjangoObjectType):
5254
class Meta:
5355
model = Pet
5456
interfaces = (Node,)
57+
fields = "__all__"
5558

5659

5760
def get_args(field):
@@ -189,6 +192,7 @@ class ReporterFilterNode(DjangoObjectType):
189192
class Meta:
190193
model = Reporter
191194
interfaces = (Node,)
195+
fields = "__all__"
192196
filter_fields = ["first_name", "articles"]
193197

194198
field = DjangoFilterConnectionField(ReporterFilterNode)
@@ -201,12 +205,14 @@ class ReporterFilterNode(DjangoObjectType):
201205
class Meta:
202206
model = Reporter
203207
interfaces = (Node,)
208+
fields = "__all__"
204209
filter_fields = ["first_name", "articles"]
205210

206211
class ArticleFilterNode(DjangoObjectType):
207212
class Meta:
208213
model = Article
209214
interfaces = (Node,)
215+
fields = "__all__"
210216
filter_fields = ["headline", "reporter"]
211217

212218
class Query(ObjectType):
@@ -233,6 +239,7 @@ class ReporterFilterNode(DjangoObjectType):
233239
class Meta:
234240
model = Reporter
235241
interfaces = (Node,)
242+
fields = "__all__"
236243
filterset_class = ReporterFilter
237244
filter_fields = ["first_name", "articles"]
238245

@@ -247,6 +254,7 @@ class ReporterFilterNode(DjangoObjectType):
247254
class Meta:
248255
model = Reporter
249256
interfaces = (Node,)
257+
fields = "__all__"
250258
filterset_class = ReporterFilter
251259

252260
field = DjangoFilterConnectionField(ReporterFilterNode)
@@ -269,12 +277,14 @@ class ReporterFilterNode(DjangoObjectType):
269277
class Meta:
270278
model = Reporter
271279
interfaces = (Node,)
280+
fields = "__all__"
272281
filterset_class = ReporterFilter
273282

274283
class ArticleFilterNode(DjangoObjectType):
275284
class Meta:
276285
model = Article
277286
interfaces = (Node,)
287+
fields = "__all__"
278288
filterset_class = ArticleFilter
279289

280290
class Query(ObjectType):
@@ -294,12 +304,14 @@ class ReporterFilterNode(DjangoObjectType):
294304
class Meta:
295305
model = Reporter
296306
interfaces = (Node,)
307+
fields = "__all__"
297308
filter_fields = ["first_name", "articles"]
298309

299310
class ArticleFilterNode(DjangoObjectType):
300311
class Meta:
301312
interfaces = (Node,)
302313
model = Article
314+
fields = "__all__"
303315
filter_fields = ["headline", "reporter"]
304316

305317
class Query(ObjectType):
@@ -451,6 +463,7 @@ class ReporterFilterNode(DjangoObjectType):
451463
class Meta:
452464
model = Reporter
453465
interfaces = (Node,)
466+
fields = "__all__"
454467
filter_fields = {"first_name": ["icontains"]}
455468

456469
class Query(ObjectType):
@@ -496,6 +509,7 @@ def resolve_child_reporters(self, **args):
496509
class Meta:
497510
model = Reporter
498511
interfaces = (Node,)
512+
fields = "__all__"
499513

500514
class Query(ObjectType):
501515
all_reporters = DjangoFilterConnectionField(ReporterFilterNode)
@@ -521,11 +535,13 @@ class ReporterType(DjangoObjectType):
521535
class Meta:
522536
model = Reporter
523537
interfaces = (Node,)
538+
fields = "__all__"
524539

525540
class ArticleType(DjangoObjectType):
526541
class Meta:
527542
model = Article
528543
interfaces = (Node,)
544+
fields = "__all__"
529545
filter_fields = ("lang",)
530546

531547
class Query(ObjectType):
@@ -610,6 +626,7 @@ class ReporterType(DjangoObjectType):
610626
class Meta:
611627
model = Reporter
612628
interfaces = (Node,)
629+
fields = "__all__"
613630
filter_fields = ()
614631

615632
class Query(ObjectType):
@@ -676,6 +693,7 @@ def resolve_full_name(instance, info, **args):
676693
class Meta:
677694
model = Reporter
678695
interfaces = (Node,)
696+
fields = "__all__"
679697
filter_fields = ()
680698

681699
class Query(ObjectType):
@@ -718,6 +736,7 @@ class ReporterType(DjangoObjectType):
718736
class Meta:
719737
model = Reporter
720738
interfaces = (Node,)
739+
fields = "__all__"
721740
filter_fields = ()
722741

723742
class Query(ObjectType):
@@ -758,6 +777,7 @@ class ReporterType(DjangoObjectType):
758777
class Meta:
759778
model = Reporter
760779
interfaces = (Node,)
780+
fields = "__all__"
761781
filter_fields = ()
762782

763783
@classmethod
@@ -920,13 +940,15 @@ class NewReporterNode(DjangoObjectType):
920940
class Meta:
921941
model = Reporter
922942
interfaces = (Node,)
943+
fields = "__all__"
923944

924945
class NewArticleFilterNode(DjangoObjectType):
925946
viewer = Field(NewReporterNode)
926947

927948
class Meta:
928949
model = Article
929950
interfaces = (Node,)
951+
fields = "__all__"
930952
filterset_class = NewArticleFilter
931953

932954
def resolve_viewer(self, info):

graphene_django/rest_framework/tests/test_multiple_model_serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ class ParentType(DjangoObjectType):
2727
class Meta:
2828
model = MyFakeParentModel
2929
interfaces = (graphene.relay.Node,)
30+
fields = "__all__"
3031

3132

3233
class ChildType(DjangoObjectType):
3334
class Meta:
3435
model = MyFakeChildModel
3536
interfaces = (graphene.relay.Node,)
37+
fields = "__all__"
3638

3739

3840
class MyModelChildSerializer(serializers.ModelSerializer):

graphene_django/rest_framework/tests/test_mutation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def test_nested_model():
163163
class MyFakeModelGrapheneType(DjangoObjectType):
164164
class Meta:
165165
model = MyFakeModel
166+
fields = "__all__"
166167

167168
class MyMutation(SerializerMutation):
168169
class Meta:

graphene_django/tests/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Character(DjangoObjectType):
99
class Meta:
1010
model = Reporter
1111
interfaces = (relay.Node,)
12+
fields = "__all__"
1213

1314
def get_node(self, info, id):
1415
pass
@@ -20,6 +21,7 @@ class Human(DjangoObjectType):
2021
class Meta:
2122
model = Article
2223
interfaces = (relay.Node,)
24+
fields = "__all__"
2325

2426
def resolve_raises(self, info):
2527
raise Exception("This field should raise exception")

graphene_django/tests/test_converter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def test_should_manytomany_convert_connectionorlist_list():
245245
class A(DjangoObjectType):
246246
class Meta:
247247
model = Reporter
248+
fields = "__all__"
248249

249250
graphene_field = convert_django_field(
250251
Reporter._meta.local_many_to_many[0], A._meta.registry
@@ -265,6 +266,7 @@ class A(DjangoObjectType):
265266
class Meta:
266267
model = Reporter
267268
interfaces = (Node,)
269+
fields = "__all__"
268270

269271
graphene_field = convert_django_field(
270272
Reporter._meta.local_many_to_many[0], A._meta.registry
@@ -279,6 +281,7 @@ def test_should_manytoone_convert_connectionorlist():
279281
class A(DjangoObjectType):
280282
class Meta:
281283
model = Article
284+
fields = "__all__"
282285

283286
graphene_field = convert_django_field(Reporter.articles.rel, A._meta.registry)
284287
assert isinstance(graphene_field, graphene.Dynamic)
@@ -295,6 +298,7 @@ def test_should_onetoone_reverse_convert_model():
295298
class A(DjangoObjectType):
296299
class Meta:
297300
model = FilmDetails
301+
fields = "__all__"
298302

299303
graphene_field = convert_django_field(Film.details.related, A._meta.registry)
300304
assert isinstance(graphene_field, graphene.Dynamic)

0 commit comments

Comments
 (0)