@@ -260,24 +260,27 @@ def zulip_emoji():
260
260
return OrderedDict ([("zulip" , {"code" : "zulip" , "type" : "zulip_extra_emoji" })])
261
261
262
262
263
- def display_recipient_factory (
264
- recipient_id : Optional [int ] = None , recipient_name : str = ""
265
- ):
263
+ @pytest .fixture
264
+ def display_recipient_factory ():
266
265
"""
267
266
Generate display_recipient field for (stream/PM/group) messages
268
267
FIXME: Refactor other tests to make this depend only on recipient_id.
269
268
"""
270
- return (
271
- {
272
- "id" : recipient_id ,
273
- "is_mirror_dummy" : False ,
274
- "full_name" : recipient_name ,
275
- "short_name" : f"{ recipient_id } " ,
276
- "email" : f"user-{ recipient_id } @zulip.com" ,
277
- }
278
- if recipient_id
279
- else "PTEST"
280
- )
269
+
270
+ def _factory (recipient_id : Optional [int ] = None , recipient_name : str = "" ):
271
+ return (
272
+ {
273
+ "id" : recipient_id ,
274
+ "is_mirror_dummy" : False ,
275
+ "full_name" : recipient_name ,
276
+ "short_name" : f"{ recipient_id } " ,
277
+ "email" : f"user-{ recipient_id } @zulip.com" ,
278
+ }
279
+ if recipient_id
280
+ else "PTEST"
281
+ )
282
+
283
+ return _factory
281
284
282
285
283
286
@pytest .fixture
@@ -320,14 +323,14 @@ def _factory(
320
323
321
324
322
325
@pytest .fixture
323
- def stream_msg_template (msg_template_factory ):
326
+ def stream_msg_template (display_recipient_factory , msg_template_factory ):
324
327
recipient = display_recipient_factory ()
325
328
msg_template = msg_template_factory (537286 , "stream" , 205 , 1520918722 , recipient )
326
329
return msg_template
327
330
328
331
329
332
@pytest .fixture
330
- def pm_template (msg_template_factory ):
333
+ def pm_template (display_recipient_factory , msg_template_factory ):
331
334
recipients = [
332
335
display_recipient_factory (_id , name )
333
336
for _id , name in {(5179 , "Boo Boo" ), (5140 , "Foo Foo" )}
@@ -337,7 +340,7 @@ def pm_template(msg_template_factory):
337
340
338
341
339
342
@pytest .fixture
340
- def group_pm_template (msg_template_factory ):
343
+ def group_pm_template (display_recipient_factory , msg_template_factory ):
341
344
recipients = [
342
345
display_recipient_factory (_id , name )
343
346
for _id , name in {(5179 , "Boo Boo" ), (5140 , "Foo Foo" ), (5180 , "Bar Bar" )}
0 commit comments