-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathidentity_tests.py
32 lines (25 loc) · 1.07 KB
/
identity_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from firebase_admin import firestore
from firebase_functions.identity_fn import (before_user_created,
BeforeCreateResponse,
before_user_signed_in,
BeforeSignInResponse,
AuthBlockingEvent)
@before_user_created()
def identityBeforeUserCreatedTests(
event: AuthBlockingEvent) -> BeforeCreateResponse:
uid = event.data.uid
firestore.client().collection("identityBeforeUserCreatedTests").document(
uid).set({
"eventId": event.event_id,
"timestamp": event.timestamp,
})
return BeforeCreateResponse(**event.data.__dict__)
@before_user_signed_in()
def identityBeforeUserSignedInTests(
event: AuthBlockingEvent) -> BeforeSignInResponse:
uid = event.data.uid
firestore.client().collection("identityBeforeUserSignedInTests").document(
uid).set({
"eventId": event.event_id,
"timestamp": event.timestamp,
})