File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,6 @@ def make_upper_case(data, context):
103103
104104# [START functions_firebase_analytics]
105105def hello_analytics (data , context ):
106- print (data )
107- print (context )
108106 """ Triggered by a Google Analytics for Firebase log event.
109107 Args:
110108 data (dict): The event payload.
@@ -125,3 +123,16 @@ def hello_analytics(data, context):
125123 geo_info = user_obj ["geoInfo" ]
126124 print (f'Location: { geo_info ["city" ]} , { geo_info ["country" ]} ' )
127125# [END functions_firebase_analytics]
126+
127+
128+ # [START functions_firebase_remote_config]
129+ def hello_remote_config (data , context ):
130+ """ Triggered by a change to a Firebase Remote Config value.
131+ Args:
132+ data (dict): The event payload.
133+ context (google.cloud.functions.Context): Metadata for the event.
134+ """
135+ print (f'Update type: { data ["updateType" ]} ' )
136+ print (f'Origin: { data ["updateOrigin" ]} ' )
137+ print (f'Version: { data ["versionNumber" ]} ' )
138+ # [END functions_firebase_remote_config]
Original file line number Diff line number Diff line change @@ -148,3 +148,20 @@ def test_analytics(capsys):
148148 assert 'Name: my-event' in out
149149 assert 'Device Model: Pixel' in out
150150 assert 'Location: London, UK' in out
151+
152+
153+ def test_remote_config (capsys ):
154+ data = {
155+ 'updateOrigin' : 'CONSOLE' ,
156+ 'updateType' : 'INCREMENTAL_UPDATE' ,
157+ 'versionNumber' : '1'
158+ }
159+ context = Context ()
160+
161+ main .hello_remote_config (data , context )
162+
163+ out , _ = capsys .readouterr ()
164+
165+ assert 'Update type: INCREMENTAL_UPDATE' in out
166+ assert 'Origin: CONSOLE' in out
167+ assert 'Version: 1' in out
You can’t perform that action at this time.
0 commit comments