mirror of
https://github.com/graphql-python/graphene.git
synced 2025-05-16 06:13:41 +03:00
26 lines
545 B
Python
26 lines
545 B
Python
from graphene import ObjectType, Schema, String
|
|
|
|
from ..utils import get_session
|
|
|
|
|
|
def test_get_session():
|
|
session = 'My SQLAlchemy session'
|
|
schema = Schema(session=session)
|
|
|
|
class Query(ObjectType):
|
|
x = String()
|
|
|
|
def resolve_x(self, args, info):
|
|
return get_session(info)
|
|
|
|
query = '''
|
|
query ReporterQuery {
|
|
x
|
|
}
|
|
'''
|
|
|
|
schema = Schema(query=Query, session=session)
|
|
result = schema.execute(query)
|
|
assert not result.errors
|
|
assert result.data['x'] == session
|