@@ -15,8 +15,9 @@ def assert_conversion(django_field, graphene_field, *args):
15
15
field = django_field (* args , help_text = 'Custom Help Text' )
16
16
graphene_type = convert_django_field (field )
17
17
assert isinstance (graphene_type , graphene_field )
18
- assert graphene_type .description == 'Custom Help Text'
19
- return graphene_type
18
+ field = graphene_type .as_field ()
19
+ assert field .description == 'Custom Help Text'
20
+ return field
20
21
21
22
22
23
def test_should_unknown_django_field_raise_exception ():
@@ -26,86 +27,86 @@ def test_should_unknown_django_field_raise_exception():
26
27
27
28
28
29
def test_should_date_convert_string ():
29
- assert_conversion (models .DateField , graphene .StringField )
30
+ assert_conversion (models .DateField , graphene .String )
30
31
31
32
32
33
def test_should_char_convert_string ():
33
- assert_conversion (models .CharField , graphene .StringField )
34
+ assert_conversion (models .CharField , graphene .String )
34
35
35
36
36
37
def test_should_text_convert_string ():
37
- assert_conversion (models .TextField , graphene .StringField )
38
+ assert_conversion (models .TextField , graphene .String )
38
39
39
40
40
41
def test_should_email_convert_string ():
41
- assert_conversion (models .EmailField , graphene .StringField )
42
+ assert_conversion (models .EmailField , graphene .String )
42
43
43
44
44
45
def test_should_slug_convert_string ():
45
- assert_conversion (models .SlugField , graphene .StringField )
46
+ assert_conversion (models .SlugField , graphene .String )
46
47
47
48
48
49
def test_should_url_convert_string ():
49
- assert_conversion (models .URLField , graphene .StringField )
50
+ assert_conversion (models .URLField , graphene .String )
50
51
51
52
52
53
def test_should_auto_convert_id ():
53
- assert_conversion (models .AutoField , graphene .IDField )
54
+ assert_conversion (models .AutoField , graphene .ID )
54
55
55
56
56
57
def test_should_positive_integer_convert_int ():
57
- assert_conversion (models .PositiveIntegerField , graphene .IntField )
58
+ assert_conversion (models .PositiveIntegerField , graphene .Int )
58
59
59
60
60
61
def test_should_positive_small_convert_int ():
61
- assert_conversion (models .PositiveSmallIntegerField , graphene .IntField )
62
+ assert_conversion (models .PositiveSmallIntegerField , graphene .Int )
62
63
63
64
64
65
def test_should_small_integer_convert_int ():
65
- assert_conversion (models .SmallIntegerField , graphene .IntField )
66
+ assert_conversion (models .SmallIntegerField , graphene .Int )
66
67
67
68
68
69
def test_should_big_integer_convert_int ():
69
- assert_conversion (models .BigIntegerField , graphene .IntField )
70
+ assert_conversion (models .BigIntegerField , graphene .Int )
70
71
71
72
72
73
def test_should_integer_convert_int ():
73
- assert_conversion (models .IntegerField , graphene .IntField )
74
+ assert_conversion (models .IntegerField , graphene .Int )
74
75
75
76
76
77
def test_should_boolean_convert_boolean ():
77
- field = assert_conversion (models .BooleanField , graphene .BooleanField )
78
+ field = assert_conversion (models .BooleanField , graphene .Boolean )
78
79
assert field .required is True
79
80
80
81
81
82
def test_should_nullboolean_convert_boolean ():
82
- field = assert_conversion (models .NullBooleanField , graphene .BooleanField )
83
+ field = assert_conversion (models .NullBooleanField , graphene .Boolean )
83
84
assert field .required is False
84
85
85
86
86
87
def test_should_float_convert_float ():
87
- assert_conversion (models .FloatField , graphene .FloatField )
88
+ assert_conversion (models .FloatField , graphene .Float )
88
89
89
90
90
91
def test_should_manytomany_convert_connectionorlist ():
91
92
graphene_type = convert_django_field (Reporter ._meta .local_many_to_many [0 ])
92
93
assert isinstance (graphene_type , ConnectionOrListField )
93
- assert isinstance (graphene_type .field_type , DjangoModelField )
94
- assert graphene_type .field_type .model == Reporter
94
+ assert isinstance (graphene_type .type , DjangoModelField )
95
+ assert graphene_type .type .model == Reporter
95
96
96
97
97
98
def test_should_manytoone_convert_connectionorlist ():
98
99
graphene_type = convert_django_field (Reporter .articles .related )
99
100
assert isinstance (graphene_type , ConnectionOrListField )
100
- assert isinstance (graphene_type .field_type , DjangoModelField )
101
- assert graphene_type .field_type .model == Article
101
+ assert isinstance (graphene_type .type , DjangoModelField )
102
+ assert graphene_type .type .model == Article
102
103
103
104
104
105
def test_should_onetoone_convert_model ():
105
106
field = assert_conversion (models .OneToOneField , DjangoModelField , Article )
106
- assert field .model == Article
107
+ assert field .type . model == Article
107
108
108
109
109
110
def test_should_foreignkey_convert_model ():
110
111
field = assert_conversion (models .ForeignKey , DjangoModelField , Article )
111
- assert field .model == Article
112
+ assert field .type . model == Article
0 commit comments