def requests_session(token): """ Create a Requests API for testing, uses the token for auth """ channel = fake_channel(token) requests_pb2_grpc.add_RequestsServicer_to_server(Requests(), channel) yield requests_pb2_grpc.RequestsStub(channel)
def requests_session(db, token): """ Create a Requests API for testing, uses the token for auth """ auth_interceptor = Auth(db).get_auth_interceptor(allow_jailed=False) user_id, jailed = Auth(db).get_session_for_token(token) channel = FakeChannel(user_id=user_id) requests_pb2_grpc.add_RequestsServicer_to_server(Requests(db), channel) yield requests_pb2_grpc.RequestsStub(channel)