Skip to content

Commit 83148ec

Browse files
Added test cases to verify that MessageProperties.msgid is calculated
correctly.
1 parent eb37d27 commit 83148ec

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

test/test_2700_aq.py

+16
Original file line numberDiff line numberDiff line change
@@ -375,5 +375,21 @@ def test_2716_payloadType_deprecation(self):
375375
self.book_queue_name, books_type,
376376
payloadType=books_type)
377377

378+
def test_2718_verify_msgid(self):
379+
"2718 - verify that the msgid property is returned correctly"
380+
self.__clear_books_queue()
381+
books_type = self.connection.gettype(self.book_type_name)
382+
book = books_type.newobject()
383+
book.TITLE, book.AUTHORS, book.PRICE = self.book_data[0]
384+
queue = self.connection.queue(self.book_queue_name, books_type)
385+
props = self.connection.msgproperties(payload=book)
386+
self.assertEqual(props.msgid, None)
387+
queue.enqone(props)
388+
self.cursor.execute("select msgid from book_queue_tab")
389+
actual_msgid, = self.cursor.fetchone()
390+
self.assertEqual(props.msgid, actual_msgid)
391+
props = queue.deqone()
392+
self.assertEqual(props.msgid, actual_msgid)
393+
378394
if __name__ == "__main__":
379395
test_env.run_test_cases()

test/test_2800_bulk_aq.py

+14
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,19 @@ def test_2804_enq_and_deq_visibility(self):
131131
messages = other_queue.deqmany(5)
132132
self.assertEqual(len(messages), 0)
133133

134+
def test_2806_verify_msgid(self):
135+
"2806 - verify that the msgid property is returned correctly"
136+
queue = self.__get_and_clear_raw_queue()
137+
messages = [self.connection.msgproperties(payload=d) \
138+
for d in RAW_PAYLOAD_DATA]
139+
queue.enqmany(messages)
140+
self.cursor.execute("select msgid from raw_queue_tab")
141+
actual_msgids = set(m for m, in self.cursor)
142+
msgids = set(m.msgid for m in messages)
143+
self.assertEqual(msgids, actual_msgids)
144+
messages = queue.deqmany(len(RAW_PAYLOAD_DATA))
145+
msgids = set(m.msgid for m in messages)
146+
self.assertEqual(msgids, actual_msgids)
147+
134148
if __name__ == "__main__":
135149
test_env.run_test_cases()

0 commit comments

Comments
 (0)