File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 76
76
useBuildpacks : false
77
77
validateConcurrency : true
78
78
cmd : " 'functions-framework --source tests/conformance/main.py --target write_http_declarative_concurrent'"
79
+
80
+ - name : Run Typed tests declarative
81
+ uses :
GoogleCloudPlatform/functions-framework-conformance/[email protected]
82
+ with :
83
+ version : ' v1.6.0'
84
+ functionType : ' http'
85
+ useBuildpacks : false
86
+ validateMapping : false
87
+ cmd : " 'functions-framework --source tests/conformance/main.py --target write_typed_event_declarative'"
Original file line number Diff line number Diff line change 8
8
filename = "function_output.json"
9
9
10
10
11
+ class ConformanceType :
12
+ json_request : str
13
+
14
+ def __init__ (self , json_request : str ) -> None :
15
+ self .json_request = json_request
16
+
17
+ @staticmethod
18
+ def from_dict (obj : dict ) -> "ConformanceType" :
19
+ return ConformanceType (json .dumps (obj ))
20
+
21
+
11
22
def _write_output (content ):
12
23
with open (filename , "w" ) as f :
13
24
f .write (content )
@@ -53,3 +64,9 @@ def write_cloud_event_declarative(cloud_event):
53
64
def write_http_declarative_concurrent (request ):
54
65
time .sleep (1 )
55
66
return "OK" , 200
67
+
68
+
69
+ @functions_framework .typed (ConformanceType )
70
+ def write_typed_event_declarative (x ):
71
+ _write_output (x .json_request )
72
+ return "OK"
You can’t perform that action at this time.
0 commit comments