@@ -33,6 +33,71 @@ def test_webhook_deserialization(self, http_client):
33
33
assert webhook .created_at == 1234567890
34
34
assert webhook .updated_at == 1234567890
35
35
36
+ def test_webhook_deserialization_all (self , http_client ):
37
+ trigger_types = [
38
+ "booking.created" ,
39
+ "booking.pending" ,
40
+ "booking.rescheduled" ,
41
+ "booking.cancelled" ,
42
+ "booking.reminder" ,
43
+ "calendar.created" ,
44
+ "calendar.updated" ,
45
+ "calendar.deleted" ,
46
+ "contact.updated" ,
47
+ "contact.deleted" ,
48
+ "event.created" ,
49
+ "event.updated" ,
50
+ "event.deleted" ,
51
+ "grant.created" ,
52
+ "grant.updated" ,
53
+ "grant.deleted" ,
54
+ "grant.expired" ,
55
+ "message.send_success" ,
56
+ "message.send_failed" ,
57
+ "message.bounce_detected" ,
58
+ "message.created" ,
59
+ "message.updated" ,
60
+ "message.opened" ,
61
+ "message.link_clicked" ,
62
+ "message.opened.legacy" ,
63
+ "message.link_clicked.legacy" ,
64
+ "message.intelligence.order" ,
65
+ "message.intelligence.tracking" ,
66
+ "message.intelligence.return" ,
67
+ "thread.replied" ,
68
+ "thread.replied.legacy" ,
69
+ "folder.created" ,
70
+ "folder.updated" ,
71
+ "folder.deleted"
72
+ ]
73
+
74
+ webhook_json = {
75
+ "id" : "UMWjAjMeWQ4D8gYF2moonK4486" ,
76
+ "description" : "Production webhook destination" ,
77
+ "trigger_types" : trigger_types ,
78
+ "webhook_url" : "https://example.com/webhooks" ,
79
+ "status" : "active" ,
80
+ "notification_email_addresses" : ["jane@example.com" , "joe@example.com" ],
81
+ "status_updated_at" : 1234567890 ,
82
+ "created_at" : 1234567890 ,
83
+ "updated_at" : 1234567890 ,
84
+ }
85
+
86
+ webhook = Webhook .from_dict (webhook_json )
87
+
88
+ assert webhook .id == "UMWjAjMeWQ4D8gYF2moonK4486"
89
+ assert webhook .description == "Production webhook destination"
90
+ assert webhook .trigger_types == trigger_types
91
+ assert webhook .webhook_url == "https://example.com/webhooks"
92
+ assert webhook .status == "active"
93
+ assert webhook .notification_email_addresses == [
94
+ "jane@example.com" ,
95
+ "joe@example.com" ,
96
+ ]
97
+ assert webhook .status_updated_at == 1234567890
98
+ assert webhook .created_at == 1234567890
99
+ assert webhook .updated_at == 1234567890
100
+
36
101
def test_list_webhooks (self , http_client_list_response ):
37
102
webhooks = Webhooks (http_client_list_response )
38
103
0 commit comments