Added two more tests on field naming

This commit is contained in:
Syrus Akbary 2015-10-02 22:56:37 -07:00
parent 701c49db26
commit 1eee2912d8

View File

@ -51,6 +51,18 @@ def test_field_type():
assert f.internal_type(schema) == GraphQLString assert f.internal_type(schema) == GraphQLString
def test_field_name_automatic_camelcase():
f = Field(GraphQLString)
f.contribute_to_class(ot, 'field_name')
assert f.name == 'fieldName'
def test_field_name_use_name_if_exists():
f = Field(GraphQLString, name='my_custom_name')
f.contribute_to_class(ot, 'field_name')
assert f.name == 'my_custom_name'
def test_stringfield_type(): def test_stringfield_type():
f = StringField() f = StringField()
f.contribute_to_class(ot, 'field_name') f.contribute_to_class(ot, 'field_name')