@@ -34,6 +34,10 @@ def on_track_listener(*args):
34
34
pass
35
35
36
36
37
+ def on_log_event_listener (* args ):
38
+ pass
39
+
40
+
37
41
class NotificationCenterTest (unittest .TestCase ):
38
42
39
43
def test_add_notification_listener__valid_type (self ):
@@ -59,6 +63,11 @@ def test_add_notification_listener__valid_type(self):
59
63
4 , test_notification_center .add_notification_listener (enums .NotificationTypes .TRACK , on_track_listener )
60
64
)
61
65
66
+ self .assertEqual (
67
+ 5 , test_notification_center .add_notification_listener (enums .NotificationTypes .LOG_EVENT ,
68
+ on_log_event_listener )
69
+ )
70
+
62
71
def test_add_notification_listener__multiple_listeners (self ):
63
72
""" Test that multiple listeners of the same type can be successfully added. """
64
73
@@ -138,6 +147,7 @@ def another_on_activate_listener(*args):
138
147
self .assertEqual (2 , len (test_notification_center .notification_listeners [enums .NotificationTypes .ACTIVATE ]))
139
148
self .assertEqual (1 , len (test_notification_center .notification_listeners [enums .NotificationTypes .DECISION ]))
140
149
self .assertEqual (0 , len (test_notification_center .notification_listeners [enums .NotificationTypes .TRACK ]))
150
+ self .assertEqual (0 , len (test_notification_center .notification_listeners [enums .NotificationTypes .LOG_EVENT ]))
141
151
142
152
# Remove one of the activate listeners and assert.
143
153
self .assertTrue (test_notification_center .remove_notification_listener (3 ))
@@ -164,6 +174,10 @@ def another_on_activate_listener(*args):
164
174
3 , test_notification_center .add_notification_listener (enums .NotificationTypes .ACTIVATE ,
165
175
another_on_activate_listener )
166
176
)
177
+ self .assertEqual (
178
+ 4 , test_notification_center .add_notification_listener (enums .NotificationTypes .LOG_EVENT ,
179
+ on_log_event_listener )
180
+ )
167
181
168
182
# Try removing a listener which does not exist.
169
183
self .assertFalse (test_notification_center .remove_notification_listener (42 ))
@@ -180,6 +194,7 @@ def test_clear_notification_listeners(self):
180
194
on_config_update_listener )
181
195
test_notification_center .add_notification_listener (enums .NotificationTypes .DECISION , on_decision_listener )
182
196
test_notification_center .add_notification_listener (enums .NotificationTypes .TRACK , on_track_listener )
197
+ test_notification_center .add_notification_listener (enums .NotificationTypes .LOG_EVENT , on_log_event_listener )
183
198
184
199
# Assert all listeners are there:
185
200
for notification_type in notification_center .NOTIFICATION_TYPES :
@@ -210,6 +225,7 @@ def test_clear_all_notification_listeners(self):
210
225
on_config_update_listener )
211
226
test_notification_center .add_notification_listener (enums .NotificationTypes .DECISION , on_decision_listener )
212
227
test_notification_center .add_notification_listener (enums .NotificationTypes .TRACK , on_track_listener )
228
+ test_notification_center .add_notification_listener (enums .NotificationTypes .LOG_EVENT , on_log_event_listener )
213
229
214
230
# Assert all listeners are there:
215
231
for notification_type in notification_center .NOTIFICATION_TYPES :
0 commit comments