88
99async def create_apt (cli , company , url = None , ** kwargs ):
1010 data = dict (
11+ id = 123 ,
1112 service_id = 123 ,
1213 service_name = 'testing service' ,
1314 extra_attributes = [],
@@ -203,22 +204,25 @@ async def test_mass_apts(cli, db_conn, company):
203204 assert 1 == await count (db_conn , sa_appointments )
204205 assert 1 == await count (db_conn , sa_services )
205206
206- data = dict ()
207+ data = { 'appointments' : []}
207208 for i in range (10 ):
208- data [str (i + 2 )] = dict (
209- service_id = 1 ,
210- service_name = 'test service' ,
211- extra_attributes = [],
212- colour = '#000000' ,
213- appointment_topic = 'testing appointment' ,
214- attendees_max = 42 ,
215- attendees_count = 4 ,
216- attendees_current_ids = [1 , 2 , 3 ],
217- start = str (datetime (2032 , 1 , 1 , 12 , 0 , 0 ) + timedelta (days = i + 1 )),
218- finish = str (datetime (2032 , 1 , 1 , 13 , 0 , 0 ) + timedelta (days = i + 1 )),
219- price = 123.45 ,
220- location = 'Whatever' ,
221- ss_method = 'POST' ,
209+ data ['appointments' ].append (
210+ dict (
211+ id = i + 2 ,
212+ service_id = 1 ,
213+ service_name = 'test service' ,
214+ extra_attributes = [],
215+ colour = '#000000' ,
216+ appointment_topic = 'testing appointment' ,
217+ attendees_max = 42 ,
218+ attendees_count = 4 ,
219+ attendees_current_ids = [1 , 2 , 3 ],
220+ start = str (datetime (2032 , 1 , 1 , 12 , 0 , 0 ) + timedelta (days = i + 1 )),
221+ finish = str (datetime (2032 , 1 , 1 , 13 , 0 , 0 ) + timedelta (days = i + 1 )),
222+ price = 123.45 ,
223+ location = 'Whatever' ,
224+ ss_method = 'POST' ,
225+ )
222226 )
223227 url = cli .server .app .router ['webhook-appointment-mass' ].url_for (company = 'thepublickey' )
224228 r = await signed_request (cli , url , ** data )
@@ -228,25 +232,28 @@ async def test_mass_apts(cli, db_conn, company):
228232 assert 11 == await count (db_conn , sa_appointments )
229233 assert 1 == await count (db_conn , sa_services )
230234
231- data = dict ()
235+ data = { 'appointments' : []}
232236 for i in range (9 ):
233- data [str (i + 2 )] = dict (
234- service_id = 1 ,
235- service_name = 'test service' ,
236- extra_attributes = [],
237- colour = '#000000' ,
238- appointment_topic = 'testing appointment' ,
239- attendees_max = 42 ,
240- attendees_count = 4 ,
241- attendees_current_ids = [1 , 2 , 3 ],
242- start = str (datetime (2032 , 1 , 1 , 12 , 0 , 0 ) + timedelta (days = i + 1 )),
243- finish = str (datetime (2032 , 1 , 1 , 13 , 0 , 0 ) + timedelta (days = i + 1 )),
244- price = 123.45 ,
245- location = 'Whatever' ,
246- ss_method = 'POST' ,
237+ data ['appointments' ].append (
238+ dict (
239+ id = i + 2 ,
240+ service_id = 1 ,
241+ service_name = 'test service' ,
242+ extra_attributes = [],
243+ colour = '#000000' ,
244+ appointment_topic = 'testing appointment' ,
245+ attendees_max = 42 ,
246+ attendees_count = 4 ,
247+ attendees_current_ids = [1 , 2 , 3 ],
248+ start = str (datetime (2032 , 1 , 1 , 12 , 0 , 0 ) + timedelta (days = i + 1 )),
249+ finish = str (datetime (2032 , 1 , 1 , 13 , 0 , 0 ) + timedelta (days = i + 1 )),
250+ price = 123.45 ,
251+ location = 'Whatever' ,
252+ ss_method = 'POST' ,
253+ )
247254 )
248- data ['10' ] = { 'ss_method' : 'DELETE' }
249- data ['11' ] = { 'ss_method' : 'DELETE' }
255+ data ['appointments' ]. append ({ 'id' : 10 , 'ss_method' : 'DELETE' })
256+ data ['appointments' ]. append ({ 'id' : 11 , 'ss_method' : 'DELETE' })
250257 url = cli .server .app .router ['webhook-appointment-mass' ].url_for (company = 'thepublickey' )
251258 r = await signed_request (cli , url , ** data )
252259 assert r .status == 200
@@ -261,22 +268,25 @@ async def test_mass_apts_and_services(cli, db_conn, company):
261268 assert 1 == await count (db_conn , sa_appointments )
262269 assert 1 == await count (db_conn , sa_services )
263270
264- data = dict ()
271+ data = { 'appointments' : []}
265272 for i in range (10 ):
266- data [str (i + 2 )] = dict (
267- service_id = i + 2 ,
268- service_name = 'test service' ,
269- extra_attributes = [],
270- colour = '#000000' ,
271- appointment_topic = 'testing appointment' ,
272- attendees_max = 42 ,
273- attendees_count = 4 ,
274- attendees_current_ids = [1 , 2 , 3 ],
275- start = str (datetime (2032 , 1 , 1 , 12 , 0 , 0 ) + timedelta (days = i + 1 )),
276- finish = str (datetime (2032 , 1 , 1 , 13 , 0 , 0 ) + timedelta (days = i + 1 )),
277- price = 123.45 ,
278- location = 'Whatever' ,
279- ss_method = 'POST' ,
273+ data ['appointments' ].append (
274+ dict (
275+ id = i + 2 ,
276+ service_id = i + 2 ,
277+ service_name = 'test service' ,
278+ extra_attributes = [],
279+ colour = '#000000' ,
280+ appointment_topic = 'testing appointment' ,
281+ attendees_max = 42 ,
282+ attendees_count = 4 ,
283+ attendees_current_ids = [1 , 2 , 3 ],
284+ start = str (datetime (2032 , 1 , 1 , 12 , 0 , 0 ) + timedelta (days = i + 1 )),
285+ finish = str (datetime (2032 , 1 , 1 , 13 , 0 , 0 ) + timedelta (days = i + 1 )),
286+ price = 123.45 ,
287+ location = 'Whatever' ,
288+ ss_method = 'POST' ,
289+ )
280290 )
281291 url = cli .server .app .router ['webhook-appointment-mass' ].url_for (company = 'thepublickey' )
282292 r = await signed_request (cli , url , ** data )
0 commit comments