@@ -73,20 +73,28 @@ def test_list_workspace_notifications(self):
7373
7474 # Test list operation
7575 workspace_id = "ws-123456789"
76- result = self .notifications .list (workspace_id )
76+ result_iter = self .notifications .list (workspace_id )
77+ items = list (result_iter )
7778
78- # Verify API call
79- self .mock_transport .request .assert_called_once_with (
80- "GET" ,
81- f"/api/v2/workspaces/{ workspace_id } /notification-configurations" ,
82- params = None ,
79+ # Verify API call (occurs when iterator is consumed)
80+ self .mock_transport .request .assert_called_once ()
81+ call_args = self .mock_transport .request .call_args
82+ assert call_args [0 ][0 ] == "GET"
83+ assert (
84+ call_args [0 ][1 ]
85+ == f"/api/v2/workspaces/{ workspace_id } /notification-configurations"
8386 )
87+ params = call_args [1 ].get ("params" )
88+ assert isinstance (params , dict )
89+ assert "page[number]" in params and "page[size]" in params
90+ assert params ["page[number]" ] == 1
91+ assert params ["page[size]" ] == 100
8492
8593 # Verify result
86- assert isinstance ( result , NotificationConfigurationList )
87- assert len ( result . items ) == 1
88- assert result . items [0 ].id == "nc-123456789"
89- assert result . items [0 ].name == "Test Notification"
94+ assert len ( items ) == 1
95+ assert isinstance ( items [ 0 ], NotificationConfiguration )
96+ assert items [0 ].id == "nc-123456789"
97+ assert items [0 ].name == "Test Notification"
9098
9199 def test_list_team_notifications (self ):
92100 """Test listing notification configurations for a team."""
@@ -105,16 +113,23 @@ def test_list_team_notifications(self):
105113 team_choice = NotificationConfigurationSubscribableChoice (team = {"id" : team_id })
106114 options = NotificationConfigurationListOptions (subscribable_choice = team_choice )
107115
108- result = self .notifications .list (team_id , options )
116+ result_iter = self .notifications .list (team_id , options )
117+ items = list (result_iter )
109118
110- # Verify API call
111- self .mock_transport .request .assert_called_once_with (
112- "GET" , f"/api/v2/teams/{ team_id } /notification-configurations" , params = {}
113- )
119+ # Verify API call (occurs when iterator is consumed)
120+ self .mock_transport .request .assert_called_once ()
121+ call_args = self .mock_transport .request .call_args
122+ assert call_args [0 ][0 ] == "GET"
123+ assert call_args [0 ][1 ] == f"/api/v2/teams/{ team_id } /notification-configurations"
124+ params = call_args [1 ].get ("params" )
125+ assert isinstance (params , dict )
126+ assert "page[number]" in params and "page[size]" in params
127+ assert params ["page[number]" ] == 1
128+ assert params ["page[size]" ] == 100
114129
115130 # Verify result
116- assert isinstance ( result , NotificationConfigurationList )
117- assert len ( result . items ) == 1
131+ assert len ( items ) == 1
132+ assert isinstance ( items [ 0 ], NotificationConfiguration )
118133
119134 def test_list_with_pagination (self ):
120135 """Test listing with pagination options."""
@@ -130,21 +145,29 @@ def test_list_with_pagination(self):
130145
131146 # Test with pagination
132147 workspace_id = "ws-123456789"
133- options = NotificationConfigurationListOptions (page_number = 2 , page_size = 50 )
148+ options = NotificationConfigurationListOptions (page_size = 50 )
134149
135- self .notifications .list (workspace_id , options )
150+ result_iter = self .notifications .list (workspace_id , options )
151+ _ = list (result_iter )
136152
137- # Verify API call with pagination
138- self .mock_transport .request .assert_called_once_with (
139- "GET" ,
140- f"/api/v2/workspaces/{ workspace_id } /notification-configurations" ,
141- params = {"page[number]" : 2 , "page[size]" : 50 },
153+ # page_size from options is respected by _list(); page[number] is controlled by _list()
154+ self .mock_transport .request .assert_called_once ()
155+ call_args = self .mock_transport .request .call_args
156+ assert call_args [0 ][0 ] == "GET"
157+ assert (
158+ call_args [0 ][1 ]
159+ == f"/api/v2/workspaces/{ workspace_id } /notification-configurations"
142160 )
161+ params = call_args [1 ].get ("params" )
162+ assert isinstance (params , dict )
163+ assert "page[number]" in params and "page[size]" in params
164+ assert params ["page[number]" ] == 1
165+ assert params ["page[size]" ] == 50
143166
144167 def test_list_invalid_id (self ):
145168 """Test list with invalid subscribable ID."""
146169 with pytest .raises (InvalidOrgError ):
147- self .notifications .list ("" )
170+ list ( self .notifications .list ("" ) )
148171
149172 def test_create_workspace_notification (self ):
150173 """Test creating a notification configuration for a workspace."""
@@ -619,10 +642,10 @@ def test_notification_configuration_list(self):
619642
620643 def test_list_options_to_dict (self ):
621644 """Test list options conversion to dictionary."""
622- options = NotificationConfigurationListOptions (page_number = 2 , page_size = 50 )
645+ options = NotificationConfigurationListOptions (page_size = 50 )
623646 result = options .to_dict ()
624647
625- assert result == {"page[number]" : 2 , "page[ size]" : 50 }
648+ assert result == {"page[size]" : 50 }
626649
627650 def test_create_options_to_dict (self ):
628651 """Test create options conversion to dictionary."""
0 commit comments