Skip to content

Commit 1acdf34

Browse files
committed
Fixed enum type tests
1 parent 1e910db commit 1acdf34

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

graphql/type/tests/test_enum_type.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,40 +130,40 @@ def test_does_not_accept_enum_literal_in_place_of_int():
130130

131131

132132
def test_accepts_json_string_as_enum_variable():
133-
result = graphql(Schema, 'query test($color: Color!) { colorEnum(fromEnum: $color) }', None, {'color': 'BLUE'})
133+
result = graphql(Schema, 'query test($color: Color!) { colorEnum(fromEnum: $color) }', variable_values={'color': 'BLUE'})
134134
assert not result.errors
135135
assert result.data == {'colorEnum': 'BLUE'}
136136

137137

138138
def test_accepts_enum_literals_as_input_arguments_to_mutations():
139-
result = graphql(Schema, 'mutation x($color: Color!) { favoriteEnum(color: $color) }', None, {'color': 'GREEN'})
139+
result = graphql(Schema, 'mutation x($color: Color!) { favoriteEnum(color: $color) }', variable_values={'color': 'GREEN'})
140140
assert not result.errors
141141
assert result.data == {'favoriteEnum': 'GREEN'}
142142

143143

144144
def test_accepts_enum_literals_as_input_arguments_to_subscriptions():
145145
result = graphql(
146-
Schema, 'subscription x($color: Color!) { subscribeToEnum(color: $color) }', None, {
146+
Schema, 'subscription x($color: Color!) { subscribeToEnum(color: $color) }', variable_values={
147147
'color': 'GREEN'})
148148
assert not result.errors
149149
assert result.data == {'subscribeToEnum': 'GREEN'}
150150

151151

152152
def test_does_not_accept_internal_value_as_enum_variable():
153-
result = graphql(Schema, 'query test($color: Color!) { colorEnum(fromEnum: $color) }', None, {'color': 2})
153+
result = graphql(Schema, 'query test($color: Color!) { colorEnum(fromEnum: $color) }', variable_values={'color': 2})
154154
assert not result.data
155155
assert result.errors[0].message == 'Variable "$color" got invalid value 2.\n' \
156156
'Expected type "Color", found 2.'
157157

158158

159159
def test_does_not_accept_string_variables_as_enum_input():
160-
result = graphql(Schema, 'query test($color: String!) { colorEnum(fromEnum: $color) }', None, {'color': 'BLUE'})
160+
result = graphql(Schema, 'query test($color: String!) { colorEnum(fromEnum: $color) }', variable_values={'color': 'BLUE'})
161161
assert not result.data
162162
assert result.errors[0].message == 'Variable "color" of type "String!" used in position expecting type "Color".'
163163

164164

165165
def test_does_not_accept_internal_value_as_enum_input():
166-
result = graphql(Schema, 'query test($color: Int!) { colorEnum(fromEnum: $color) }', None, {'color': 2})
166+
result = graphql(Schema, 'query test($color: Int!) { colorEnum(fromEnum: $color) }', variable_values={'color': 2})
167167
assert not result.data
168168
assert result.errors[0].message == 'Variable "color" of type "Int!" used in position expecting type "Color".'
169169

0 commit comments

Comments
 (0)