@@ -46,6 +46,22 @@ def test_notifications_short_and_legacy_alias(monkeypatch):
4646 ]
4747
4848
49+ def test_notifications_map_channels_to_target (monkeypatch ):
50+ monkeypatch .setattr (client_module , "PushNotificationsApi" , FakePushNotificationsApi )
51+ monkeypatch .setattr (client_module , "LiveActivitiesApi" , FakeLiveActivitiesApi )
52+
53+ client = ActivitySmith (api_key = "x" )
54+ payload = {"title" : "Build Failed" , "channels" : ["devs" , "ops" ]}
55+
56+ client .notifications .send (payload )
57+ client .notifications .send_push_notification ({"title" : "Build Failed" , "channels" : "devs,ops" })
58+
59+ assert client .notifications ._api .calls == [
60+ {"push_notification_request" : {"title" : "Build Failed" , "target" : {"channels" : ["devs" , "ops" ]}}},
61+ {"push_notification_request" : {"title" : "Build Failed" , "target" : {"channels" : ["devs" , "ops" ]}}},
62+ ]
63+
64+
4965def test_live_activities_short_and_legacy_aliases (monkeypatch ):
5066 monkeypatch .setattr (client_module , "PushNotificationsApi" , FakePushNotificationsApi )
5167 monkeypatch .setattr (client_module , "LiveActivitiesApi" , FakeLiveActivitiesApi )
@@ -84,3 +100,36 @@ def test_live_activities_short_and_legacy_aliases(monkeypatch):
84100 ("update" , {"live_activity_update_request" : update_payload }),
85101 ("end" , {"live_activity_end_request" : end_payload }),
86102 ]
103+
104+
105+ def test_live_activities_start_maps_channels_to_target (monkeypatch ):
106+ monkeypatch .setattr (client_module , "PushNotificationsApi" , FakePushNotificationsApi )
107+ monkeypatch .setattr (client_module , "LiveActivitiesApi" , FakeLiveActivitiesApi )
108+
109+ client = ActivitySmith (api_key = "x" )
110+ payload = {
111+ "content_state" : {
112+ "title" : "Deploy" ,
113+ "number_of_steps" : 4 ,
114+ "current_step" : 1 ,
115+ "type" : "segmented_progress" ,
116+ },
117+ "channels" : ["devs" , "ops" ],
118+ }
119+
120+ client .live_activities .start (payload )
121+ client .live_activities .start_live_activity (payload )
122+
123+ expected = {
124+ "content_state" : {
125+ "title" : "Deploy" ,
126+ "number_of_steps" : 4 ,
127+ "current_step" : 1 ,
128+ "type" : "segmented_progress" ,
129+ },
130+ "target" : {"channels" : ["devs" , "ops" ]},
131+ }
132+ assert client .live_activities ._api .calls == [
133+ ("start" , {"live_activity_start_request" : expected }),
134+ ("start" , {"live_activity_start_request" : expected }),
135+ ]
0 commit comments