Exemplo n.º 1
0
def test_defines_a_query_only_schema():
    BlogSchema = GraphQLSchema(BlogQuery)

    assert BlogSchema.get_query_type() == BlogQuery

    article_field = BlogQuery.fields['article']
    assert article_field.type == BlogArticle
    assert article_field.type.name == 'Article'
    # assert article_field.name == 'article'

    article_field_type = article_field.type
    assert isinstance(article_field_type, GraphQLObjectType)

    title_field = article_field_type.fields['title']
    # assert title_field.name == 'title'
    assert title_field.type == GraphQLString
    assert title_field.type.name == 'String'

    author_field = article_field_type.fields['author']
    author_field_type = author_field.type
    assert isinstance(author_field_type, GraphQLObjectType)
    recent_article_field = author_field_type.fields['recentArticle']

    assert recent_article_field.type == BlogArticle

    feed_field = BlogQuery.fields['feed']
    assert feed_field.type.of_type == BlogArticle
Exemplo n.º 2
0
def test_defines_a_query_only_schema():
    BlogSchema = GraphQLSchema(BlogQuery)

    assert BlogSchema.get_query_type() == BlogQuery

    article_field = BlogQuery.fields["article"]
    assert article_field.type == BlogArticle
    assert article_field.type.name == "Article"
    # assert article_field.name == 'article'

    article_field_type = article_field.type
    assert isinstance(article_field_type, GraphQLObjectType)

    title_field = article_field_type.fields["title"]
    # assert title_field.name == 'title'
    assert title_field.type == GraphQLString
    assert title_field.type.name == "String"

    author_field = article_field_type.fields["author"]
    author_field_type = author_field.type
    assert isinstance(author_field_type, GraphQLObjectType)
    recent_article_field = author_field_type.fields["recentArticle"]

    assert recent_article_field.type == BlogArticle

    feed_field = BlogQuery.fields["feed"]
    assert feed_field.type.of_type == BlogArticle
Exemplo n.º 3
0
def test_defines_a_query_only_schema():
    BlogSchema = GraphQLSchema(BlogQuery)

    assert BlogSchema.get_query_type() == BlogQuery

    article_field = BlogQuery.get_fields()['article']
    assert article_field.type == BlogArticle
    assert article_field.type.name == 'Article'
    assert article_field.name == 'article'

    article_field_type = article_field.type
    assert isinstance(article_field_type, GraphQLObjectType)

    title_field = article_field_type.get_fields()['title']
    assert title_field.name == 'title'
    assert title_field.type == GraphQLString
    assert title_field.type.name == 'String'

    author_field = article_field_type.get_fields()['author']
    author_field_type = author_field.type
    assert isinstance(author_field_type, GraphQLObjectType)
    recent_article_field = author_field_type.get_fields()['recentArticle']

    assert recent_article_field.type == BlogArticle

    feed_field = BlogQuery.get_fields()['feed']
    assert feed_field.type.of_type == BlogArticle
    assert feed_field.name == 'feed'