File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ class Meta:
5252 assert 'model' in MyMutation .Input ._meta .fields
5353
5454
55+ def test_exclude_fields ():
56+ class MyMutation (SerializerMutation ):
57+ class Meta :
58+ serializer_class = MyModelSerializer
59+ exclude_fields = ['created' ]
60+
61+ assert 'cool_name' in MyMutation ._meta .fields
62+ assert 'created' not in MyMutation ._meta .fields
63+ assert 'errors' in MyMutation ._meta .fields
64+ assert 'cool_name' in MyMutation .Input ._meta .fields
65+ assert 'created' not in MyMutation .Input ._meta .fields
66+
67+
5568def test_nested_model ():
5669
5770 class MyFakeModelGrapheneType (DjangoObjectType ):
Original file line number Diff line number Diff line change 11from django .core .exceptions import ValidationError
22from py .test import raises
33
4- from ..forms import GlobalIDFormField
4+ from ..forms import GlobalIDFormField , GlobalIDMultipleChoiceField
55
66
77# 'TXlUeXBlOmFiYw==' -> 'MyType', 'abc'
@@ -18,6 +18,17 @@ def test_global_id_invalid():
1818 field .clean ('badvalue' )
1919
2020
21+ def test_global_id_multiple_valid ():
22+ field = GlobalIDMultipleChoiceField ()
23+ field .clean (['TXlUeXBlOmFiYw==' , 'TXlUeXBlOmFiYw==' ])
24+
25+
26+ def test_global_id_multiple_invalid ():
27+ field = GlobalIDMultipleChoiceField ()
28+ with raises (ValidationError ):
29+ field .clean (['badvalue' , 'another bad avue' ])
30+
31+
2132def test_global_id_none ():
2233 field = GlobalIDFormField ()
2334 with raises (ValidationError ):
You can’t perform that action at this time.
0 commit comments