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:
52
52
assert 'model' in MyMutation .Input ._meta .fields
53
53
54
54
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
+
55
68
def test_nested_model ():
56
69
57
70
class MyFakeModelGrapheneType (DjangoObjectType ):
Original file line number Diff line number Diff line change 1
1
from django .core .exceptions import ValidationError
2
2
from py .test import raises
3
3
4
- from ..forms import GlobalIDFormField
4
+ from ..forms import GlobalIDFormField , GlobalIDMultipleChoiceField
5
5
6
6
7
7
# 'TXlUeXBlOmFiYw==' -> 'MyType', 'abc'
@@ -18,6 +18,17 @@ def test_global_id_invalid():
18
18
field .clean ('badvalue' )
19
19
20
20
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
+
21
32
def test_global_id_none ():
22
33
field = GlobalIDFormField ()
23
34
with raises (ValidationError ):
You can’t perform that action at this time.
0 commit comments