@@ -138,6 +138,51 @@ def test_event_conferencing_details_autocreate_error(mocked_responses, api_clien
138138 )
139139
140140
141+ @pytest .mark .usefixtures ("mock_event_create_response" )
142+ def test_event_error_if_participants_more_than_capacity (mocked_responses , api_client ):
143+ event = blank_event (api_client )
144+ event .capacity = 1
145+ event .participants = [
146+ {"email" : "person1@email.com" },
147+ {"email" : "person2@email.com" },
148+ ]
149+ with pytest .raises (ValueError ) as excinfo :
150+ event .save ()
151+ assert "The number of participants in the event exceeds the set capacity." in str (
152+ excinfo
153+ )
154+
155+
156+ @pytest .mark .usefixtures ("mock_event_create_response" )
157+ def test_event_no_error_if_capacity_negative_one (mocked_responses , api_client ):
158+ event = blank_event (api_client )
159+ event .capacity = - 1
160+ event .participants = [
161+ {"email" : "person1@email.com" },
162+ {"email" : "person2@email.com" },
163+ ]
164+ event .save ()
165+
166+
167+ @pytest .mark .usefixtures ("mock_event_create_response" )
168+ def test_event_no_error_if_participants_less_than_eql_capacity (
169+ mocked_responses , api_client
170+ ):
171+ event = blank_event (api_client )
172+ event .capacity = 2
173+ event .participants = [
174+ {"email" : "person1@email.com" },
175+ {"email" : "person2@email.com" },
176+ ]
177+ event .save ()
178+ event .capacity = 3
179+ event .participants = [
180+ {"email" : "person1@email.com" },
181+ {"email" : "person2@email.com" },
182+ ]
183+ event .save ()
184+
185+
141186@pytest .mark .usefixtures ("mock_calendars" , "mock_events" )
142187def test_calendar_events (api_client ):
143188 calendar = api_client .calendars .first ()
0 commit comments