mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-26 19:43:56 +03:00
Improved tests
This commit is contained in:
parent
7caf96c746
commit
b91e10ef8a
|
@ -64,7 +64,7 @@ script:
|
||||||
flake8
|
flake8
|
||||||
exit
|
exit
|
||||||
elif [ "$TEST_TYPE" = build ]; then
|
elif [ "$TEST_TYPE" = build ]; then
|
||||||
py.test --cov=graphene
|
py.test graphene examples --cov=graphene
|
||||||
fi
|
fi
|
||||||
after_success:
|
after_success:
|
||||||
- |
|
- |
|
||||||
|
|
|
@ -61,7 +61,7 @@ def test_ordered_fields_in_objecttype():
|
||||||
|
|
||||||
graphql_type = MyObjectType._meta.graphql_type
|
graphql_type = MyObjectType._meta.graphql_type
|
||||||
fields = graphql_type.get_fields()
|
fields = graphql_type.get_fields()
|
||||||
assert fields.keys() == ['b', 'a', 'field', 'asa']
|
assert list(fields.keys()) == ['b', 'a', 'field', 'asa']
|
||||||
|
|
||||||
|
|
||||||
def test_objecttype_inheritance():
|
def test_objecttype_inheritance():
|
||||||
|
@ -87,12 +87,12 @@ def test_objecttype_as_container_get_fields():
|
||||||
field1 = Field(GraphQLString)
|
field1 = Field(GraphQLString)
|
||||||
field2 = Field(GraphQLString)
|
field2 = Field(GraphQLString)
|
||||||
|
|
||||||
assert Container._meta.graphql_type.get_fields().keys() == ['field1', 'field2']
|
assert list(Container._meta.graphql_type.get_fields().keys()) == ['field1', 'field2']
|
||||||
|
|
||||||
|
|
||||||
def test_parent_container_get_fields():
|
def test_parent_container_get_fields():
|
||||||
fields = Container._meta.graphql_type.get_fields()
|
fields = Container._meta.graphql_type.get_fields()
|
||||||
assert fields.keys() == ['field1', 'field2']
|
assert list(fields.keys()) == ['field1', 'field2']
|
||||||
|
|
||||||
|
|
||||||
def test_objecttype_as_container_only_args():
|
def test_objecttype_as_container_only_args():
|
||||||
|
|
|
@ -45,7 +45,7 @@ def test_scalar_in_objecttype(scalar_class, graphql_type):
|
||||||
|
|
||||||
graphql_type = get_graphql_type(MyObjectType)
|
graphql_type = get_graphql_type(MyObjectType)
|
||||||
fields = graphql_type.get_fields()
|
fields = graphql_type.get_fields()
|
||||||
assert fields.keys() == ['before', 'field', 'after']
|
assert list(fields.keys()) == ['before', 'field', 'after']
|
||||||
assert isinstance(fields['field'], Field)
|
assert isinstance(fields['field'], Field)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,4 +35,4 @@ def test_get_graphql_type_unknown_type():
|
||||||
with pytest.raises(Exception) as excinfo:
|
with pytest.raises(Exception) as excinfo:
|
||||||
get_graphql_type(object)
|
get_graphql_type(object)
|
||||||
|
|
||||||
assert "Cannot get GraphQL type of <type 'object'>." == str(excinfo.value)
|
assert "Cannot get GraphQL type" in str(excinfo.value)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user