File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
graphene_django/forms/tests Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1
1
from django import forms
2
+ from django .test import TestCase
2
3
from py .test import raises
3
4
4
5
from graphene_django .tests .models import Pet
@@ -40,10 +41,23 @@ class Meta:
40
41
assert 'text' in MyMutation .Input ._meta .fields
41
42
42
43
43
- def test_model_form ():
44
- class PetMutation (ModelFormMutation ):
45
- class Meta :
46
- form_class = PetForm
44
+ class ModelFormMutationTests (TestCase ):
45
+
46
+ def test_model_form_mutation (self ):
47
+ class PetMutation (ModelFormMutation ):
48
+ class Meta :
49
+ form_class = PetForm
50
+
51
+ self .assertEqual (PetMutation .model , Pet )
52
+ self .assertEqual (PetMutation .return_field_name , 'pet' )
53
+
54
+ def test_model_form_mutation_mutate (self ):
55
+ class PetMutation (ModelFormMutation ):
56
+ class Meta :
57
+ form_class = PetForm
58
+
59
+ PetMutation .mutate (None , {'input' : {'name' : 'Fluffy' }}, None , None )
47
60
48
- assert PetMutation .model == Pet
49
- assert PetMutation .return_field_name == 'pet'
61
+ self .assertEqual (Pet .objects .count (), 1 )
62
+ pet = Pet .objects .get ()
63
+ self .assertEqual (pet .name , 'Fluffy' )
You can’t perform that action at this time.
0 commit comments