Skip to content

Commit 0b33aca

Browse files
committed
Include the chat id in generated Messages.
1 parent e1350c8 commit 0b33aca

File tree

2 files changed

+63
-19
lines changed

2 files changed

+63
-19
lines changed

metabot/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _handler(method, request, unused_context):
117117
else:
118118
self.last_message_id += 1
119119
message_id = self.last_message_id
120-
message = {'message_id': message_id}
120+
message = {'chat': {'id': int(response['chat_id'])}, 'message_id': message_id}
121121
if response.get('caption'):
122122
message['caption'] = 'CAPTION'
123123
return {'ok': True, 'result': message}

metabot/modules/test_reminders.py

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ def test_daily_messages(daily_messages): # pylint: disable=redefined-outer-name
143143
location: Bravo Venue, Rest of Bravo Location
144144
start: 604800
145145
summary: Bravo Summary
146-
- message_id: 12345
146+
- chat:
147+
id: -1002000002000
148+
message_id: 12345
147149
- 'There are a couple events coming up:
148150
149151
<b>Alpha Summary</b>
@@ -177,7 +179,9 @@ def test_daily_messages(daily_messages): # pylint: disable=redefined-outer-name
177179
location: Bravo Venue, Rest of Bravo Location
178180
start: 604800
179181
summary: Bravo Summary
180-
- message_id: 12345
182+
- chat:
183+
id: -1002000002000
184+
message_id: 12345
181185
- 'There are a couple events coming up:
182186
183187
<b>Alpha Summary</b>
@@ -212,7 +216,9 @@ def test_daily_messages_updated(daily_messages): # pylint: disable=redefined-ou
212216
location: Bravo Venue, Rest of Bravo Location
213217
start: 604800
214218
summary: Bravo Summary
215-
- message_id: 12345
219+
- chat:
220+
id: -1002000002000
221+
message_id: 12345
216222
- 'There are a couple events coming up:
217223
218224
<b>Edited Summary</b>
@@ -253,7 +259,9 @@ def test_daily_messages_updated(daily_messages): # pylint: disable=redefined-ou
253259
location: Bravo Venue, Rest of Bravo Location
254260
start: 604800
255261
summary: Bravo Summary
256-
- message_id: 12345
262+
- chat:
263+
id: -1002000002000
264+
message_id: 12345
257265
- 'There are a couple events coming up:
258266
259267
<b>Edited Summary</b>
@@ -282,7 +290,9 @@ def test_daily_messages_future(daily_messages, monkeypatch): # pylint: disable=
282290
location: Bravo Venue, Rest of Bravo Location
283291
start: 604800
284292
summary: Bravo Summary
285-
- message_id: 12345
293+
- chat:
294+
id: -1002000002000
295+
message_id: 12345
286296
- 'There are a couple events coming up:
287297
288298
<b>Alpha Summary</b>
@@ -319,7 +329,9 @@ def test_daily_messages_future(daily_messages, monkeypatch): # pylint: disable=
319329
location: Bravo Venue, Rest of Bravo Location
320330
start: 604800
321331
summary: Bravo Summary
322-
- message_id: 12345
332+
- chat:
333+
id: -1002000002000
334+
message_id: 12345
323335
- 'There are a couple events coming up:
324336
325337
<b>Alpha Summary</b>
@@ -356,7 +368,9 @@ def test_daily_messages_future(daily_messages, monkeypatch): # pylint: disable=
356368
location: Bravo Venue, Rest of Bravo Location
357369
start: 604800
358370
summary: Bravo Summary
359-
- message_id: 12345
371+
- chat:
372+
id: -1002000002000
373+
message_id: 12345
360374
- 'There are a couple events coming up:
361375
362376
<b>Now Summary</b>
@@ -409,7 +423,9 @@ def test_daily_messages_multiline(daily_messages): # pylint: disable=redefined-
409423
location: Bravo Venue, Rest of Bravo Location
410424
start: 604800
411425
summary: Bravo Summary
412-
- message_id: 12345
426+
- chat:
427+
id: -1002000002000
428+
message_id: 12345
413429
- 'There are a couple events coming up:
414430
415431
<b>Alpha Summary</b>
@@ -471,7 +487,9 @@ def test_daily_messages_add_remove_event(conversation, daily_messages): # pylin
471487
location: New Venue, Rest of New Location
472488
start: 12600.0
473489
summary: New Summary
474-
- message_id: 12345
490+
- chat:
491+
id: -1002000002000
492+
message_id: 12345
475493
- 'There are a couple events coming up:
476494
477495
<b>Alpha Summary</b>
@@ -523,7 +541,9 @@ def test_daily_messages_ignored(daily_messages): # pylint: disable=redefined-ou
523541
location: Bravo Venue, Rest of Bravo Location
524542
start: 604800
525543
summary: Bravo Summary
526-
- message_id: 12345
544+
- chat:
545+
id: -1002000002000
546+
message_id: 12345
527547
- 'There are a couple events coming up:
528548
529549
<b>Alpha Summary</b>
@@ -550,7 +570,9 @@ def test_daily_messages_ignored(daily_messages): # pylint: disable=redefined-ou
550570
location: Bravo Venue, Rest of Bravo Location
551571
start: 604800
552572
summary: Bravo Summary
553-
- message_id: 12345
573+
- chat:
574+
id: -1002000002000
575+
message_id: 12345
554576
- 'There are a couple events coming up:
555577
556578
<b>Alpha Summary</b>
@@ -585,7 +607,9 @@ def test_daily_messages_icons(conversation, daily_messages): # pylint: disable=
585607
location: Bravo Venue, Rest of Bravo Location
586608
start: 604800
587609
summary: Bravo Summary
588-
- message_id: 12345
610+
- chat:
611+
id: -1002000002000
612+
message_id: 12345
589613
- 'There are a couple events coming up:
590614
591615
<b>Alpha Summary</b>
@@ -628,6 +652,8 @@ def test_daily_messages_icons(conversation, daily_messages): # pylint: disable=
628652
start: 604800
629653
summary: Bravo Summary
630654
- caption: CAPTION
655+
chat:
656+
id: -1002000002000
631657
message_id: 12347
632658
- 'There are a couple events coming up:
633659
@@ -665,6 +691,8 @@ def test_daily_messages_icons(conversation, daily_messages): # pylint: disable=
665691
start: 604800
666692
summary: Bravo Summary
667693
- caption: CAPTION
694+
chat:
695+
id: -1002000002000
668696
message_id: 12348
669697
- 'There are a couple events coming up:
670698
@@ -702,6 +730,8 @@ def test_daily_messages_icons(conversation, daily_messages): # pylint: disable=
702730
start: 604800
703731
summary: Bravo Summary
704732
- caption: CAPTION
733+
chat:
734+
id: -1002000002000
705735
message_id: 12349
706736
- 'There are a couple events coming up:
707737
@@ -740,6 +770,8 @@ def test_daily_messages_icons(conversation, daily_messages): # pylint: disable=
740770
start: 604800
741771
summary: Bravo Summary
742772
- caption: CAPTION
773+
chat:
774+
id: -1002000002000
743775
message_id: 12349
744776
- 'There are a couple events coming up:
745777
@@ -785,7 +817,9 @@ def test_daily_messages_geometry(conversation, daily_messages): # pylint: disab
785817
location: Alpha Venue, Rest of Alpha Location
786818
start: 9000.0
787819
summary: Alpha Summary
788-
- message_id: 12345
820+
- chat:
821+
id: -1002000002000
822+
message_id: 12345
789823
- 'There''s an event coming up:
790824
791825
<b>Alpha Summary</b>
@@ -837,7 +871,9 @@ def test_daily_messages_grammar(daily_messages): # pylint: disable=redefined-ou
837871
location: New Location
838872
start: 603000
839873
summary: Bravo Summary
840-
- message_id: 12345
874+
- chat:
875+
id: -1002000002000
876+
message_id: 12345
841877
- 'There are a couple events coming up:
842878
843879
<b>New Summary</b>
@@ -885,7 +921,9 @@ def test_daily_messages_replaced(daily_messages, monkeypatch): # pylint: disabl
885921
location: Bravo Venue, Rest of Bravo Location
886922
start: 604800
887923
summary: Bravo Summary
888-
- message_id: 12345
924+
- chat:
925+
id: -1002000002000
926+
message_id: 12345
889927
- 'There are a couple events coming up:
890928
891929
<b>Alpha Summary</b>
@@ -921,7 +959,9 @@ def test_daily_messages_replaced(daily_messages, monkeypatch): # pylint: disabl
921959
location: Charlie Venue, Rest of Charlie Location
922960
start: 604860
923961
summary: Charlie Summary
924-
- message_id: 12346
962+
- chat:
963+
id: -1002000002000
964+
message_id: 12346
925965
- 'There are a couple events coming up:
926966
927967
<b>Bravo Summary</b>
@@ -1025,7 +1065,9 @@ def test_truncation(daily_messages, monkeypatch): # pylint: disable=redefined-o
10251065
location: Bravo Venue, Rest of Bravo Location
10261066
start: 604800
10271067
summary: Bravo Summary
1028-
- message_id: 12345
1068+
- chat:
1069+
id: -1002000002000
1070+
message_id: 12345
10291071
- 'There are a couple events coming up:
10301072
10311073
<b>Alpha Summary</b>
@@ -1067,7 +1109,9 @@ def test_sanitize(daily_messages): # pylint: disable=redefined-outer-name
10671109
location: Bravo Venue, Rest of Bravo Location
10681110
start: 604800
10691111
summary: Bravo Summary
1070-
- message_id: 12345
1112+
- chat:
1113+
id: -1002000002000
1114+
message_id: 12345
10711115
- 'There are a couple events coming up:
10721116
10731117
<b>Edited &amp; &lt;i&gt; Summary</b>

0 commit comments

Comments
 (0)