@@ -22,10 +22,19 @@ def it_returns_correct_user_notification_topic(self):
2222 payload = Notification (** test_user_notification )
2323 expect (payload .topic ) == "user.created"
2424
25+ def it_returns_instance_of_user (self ):
26+ User = create_class_instance ('User' ) # noqa
27+ payload = Notification (** test_user_notification )
28+ expect (payload .model ).to .be_instance_of (User .__class__ )
29+
2530 def it_returns_instance_of_conversation (self ):
2631 Conversation = create_class_instance ('Conversation' )
2732 payload = Notification (** test_conversation_notification )
2833 expect (payload .model ).to .be_instance_of (Conversation .__class__ )
34+
35+ def it_returns_correct_model_type_for_conversation (self ):
36+ Conversation = create_class_instance ('Conversation' )
37+ payload = Notification (** test_conversation_notification )
2938 expect (payload .model_type ) == Conversation .__class__
3039
3140 def it_returns_correct_conversation_notification_topic (self ):
@@ -36,3 +45,25 @@ def it_returns_inner_user_object_for_conversation(self):
3645 User = create_class_instance ('User' )
3746 payload = Notification (** test_conversation_notification )
3847 expect (payload .model .user ).to .be_instance_of (User .__class__ )
48+
49+ def it_returns_inner_user_object_with_nil_tags (self ):
50+ user_notification = {
51+ "type" : "notification_event" ,
52+ "app_id" : "aa11aa" ,
53+ "data" : {
54+ "type" : "notification_event_data" ,
55+ "item" : {
56+ "type" : "user" ,
57+ "id" : "abc123def" ,
58+ "user_id" : "666" ,
59+ "email" : "joe@example.com" ,
60+ "name" : "Joe" ,
61+ "tags" : {
62+ "type" : "tag.list" ,
63+ "tags" : None
64+ }
65+ }
66+ }
67+ }
68+ payload = Notification (** user_notification )
69+ expect (payload .model .tags ) == []
0 commit comments