Ejemplo n.º 1
0
def test_field_resolve_vars():
    class Query(ObjectType):
        hello = String(first_name=String())

        def resolve_hello(self, args, info):
            return 'Hello ' + args.get('first_name')

    schema = Schema(query=Query)

    result = schema.execute("""
    query foo($firstName:String)
    {
            hello(firstName:$firstName)
    }
    """,
                            args={"firstName": "Serkan"})

    expected = {'hello': 'Hello Serkan'}
    assert result.data == expected
Ejemplo n.º 2
0
def test_field_resolve_vars():
    class Query(ObjectType):
        hello = String(first_name=String())

        def resolve_hello(self, args, info):
            return 'Hello ' + args.get('first_name')

    schema = Schema(query=Query)

    result = schema.execute("""
    query foo($firstName:String)
    {
            hello(firstName:$firstName)
    }
    """, variable_values={"firstName": "Serkan"})

    expected = {
        'hello': 'Hello Serkan'
    }
    assert result.data == expected