getFakeContext function

Context getFakeContext({
  1. bool useIacFile = true,
  2. String handler = 'bootstrap',
})

Implementation

Context getFakeContext({bool useIacFile = true, String handler = 'bootstrap'}) {
  final dynamic iac = useIacFile
      ? _getIacData()
      : <String, dynamic>{
          'handler': handler,
          'memory': 128,
        };
  final funcName = path.basename(Directory.current.path);
  return Context(
    requestId: _getRandomId(18),
    handler: iac['handler'].toString(),
    functionName: funcName,
    functionMemorySize: iac['memory'].toString(),
    logGroupName: 'test/lambdas',
    logStreamName: 'test/lambdas/$funcName',
    region: Platform.localHostname,
    accessKey: _getRandomId(),
    secretAccessKey: _getRandomId(),
    sessionToken: _getRandomId(),
    invokedFunction: funcName,
    executionEnv: 'test',
  );
}