File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -53,3 +53,31 @@ def init():
5353 self .assertEqual (event .auth_id , "auth-id" )
5454
5555 self .assertEqual (hello , "world" )
56+
57+ def test_missing_auth_context (self ):
58+ func = mock .Mock (__name__ = "example_func_no_auth" )
59+ decorated_func = db_fn .on_value_created (reference = "path" )(func )
60+
61+ event = CloudEvent (
62+ attributes = {
63+ "specversion" : "1.0" ,
64+ "id" : "id" ,
65+ "source" : "source" ,
66+ "subject" : "subject" ,
67+ "type" : "type" ,
68+ "time" : "2024-04-10T12:00:00.000Z" ,
69+ "instance" : "instance" ,
70+ "ref" : "ref" ,
71+ "firebasedatabasehost" : "firebasedatabasehost" ,
72+ "location" : "location" ,
73+ },
74+ data = {"delta" : "delta" },
75+ )
76+
77+ decorated_func (event )
78+
79+ func .assert_called_once ()
80+ event_arg = func .call_args .args [0 ]
81+ self .assertIsNotNone (event_arg )
82+ self .assertEqual (event_arg .auth_type , "unknown" )
83+ self .assertIsNone (event_arg .auth_id )
You can’t perform that action at this time.
0 commit comments