3
3
import os
4
4
import unittest
5
5
6
- from unittest .mock import patch , call , ANY , MagicMock
6
+ from unittest .mock import patch , call , ANY
7
7
from datadog_lambda .constants import TraceHeader
8
8
9
9
import datadog_lambda .wrapper as wrapper
12
12
from ddtrace import Span , tracer
13
13
from ddtrace .internal .constants import MAX_UINT_64BITS
14
14
15
-
16
- def get_mock_context (
17
- aws_request_id = "request-id-1" ,
18
- memory_limit_in_mb = "256" ,
19
- invoked_function_arn = "arn:aws:lambda:us-west-1:123457598159:function:python-layer-test:1" ,
20
- function_version = "1" ,
21
- client_context = {},
22
- ):
23
- lambda_context = MagicMock ()
24
- lambda_context .aws_request_id = aws_request_id
25
- lambda_context .memory_limit_in_mb = memory_limit_in_mb
26
- lambda_context .invoked_function_arn = invoked_function_arn
27
- lambda_context .function_version = function_version
28
- lambda_context .client_context = client_context
29
- return lambda_context
15
+ from tests .utils import get_mock_context
30
16
31
17
32
18
class TestDatadogLambdaWrapper (unittest .TestCase ):
@@ -232,7 +218,7 @@ def lambda_handler(event, context):
232
218
"region:us-west-1" ,
233
219
"account_id:123457598159" ,
234
220
"functionname:python-layer-test" ,
235
- "resource:python-layer-test:1 " ,
221
+ "resource:python-layer-test" ,
236
222
"cold_start:true" ,
237
223
"memorysize:256" ,
238
224
"runtime:python3.9" ,
@@ -263,7 +249,7 @@ def lambda_handler(event, context):
263
249
"region:us-west-1" ,
264
250
"account_id:123457598159" ,
265
251
"functionname:python-layer-test" ,
266
- "resource:python-layer-test:1 " ,
252
+ "resource:python-layer-test" ,
267
253
"cold_start:true" ,
268
254
"memorysize:256" ,
269
255
"runtime:python3.9" ,
@@ -279,7 +265,7 @@ def lambda_handler(event, context):
279
265
"region:us-west-1" ,
280
266
"account_id:123457598159" ,
281
267
"functionname:python-layer-test" ,
282
- "resource:python-layer-test:1 " ,
268
+ "resource:python-layer-test" ,
283
269
"cold_start:true" ,
284
270
"memorysize:256" ,
285
271
"runtime:python3.9" ,
@@ -318,7 +304,7 @@ def lambda_handler(event, context):
318
304
"region:us-west-1" ,
319
305
"account_id:123457598159" ,
320
306
"functionname:python-layer-test" ,
321
- "resource:python-layer-test:1 " ,
307
+ "resource:python-layer-test" ,
322
308
"cold_start:true" ,
323
309
"memorysize:256" ,
324
310
"runtime:python3.9" ,
@@ -334,7 +320,7 @@ def lambda_handler(event, context):
334
320
"region:us-west-1" ,
335
321
"account_id:123457598159" ,
336
322
"functionname:python-layer-test" ,
337
- "resource:python-layer-test:1 " ,
323
+ "resource:python-layer-test" ,
338
324
"cold_start:true" ,
339
325
"memorysize:256" ,
340
326
"runtime:python3.9" ,
@@ -370,7 +356,7 @@ def lambda_handler(event, context):
370
356
"region:us-west-1" ,
371
357
"account_id:123457598159" ,
372
358
"functionname:python-layer-test" ,
373
- "resource:python-layer-test:1 " ,
359
+ "resource:python-layer-test" ,
374
360
"cold_start:true" ,
375
361
"memorysize:256" ,
376
362
"runtime:python3.9" ,
@@ -386,7 +372,7 @@ def lambda_handler(event, context):
386
372
"region:us-west-1" ,
387
373
"account_id:123457598159" ,
388
374
"functionname:python-layer-test" ,
389
- "resource:python-layer-test:1 " ,
375
+ "resource:python-layer-test" ,
390
376
"cold_start:false" ,
391
377
"memorysize:256" ,
392
378
"runtime:python3.9" ,
0 commit comments