Skip to content

Commit 575ca43

Browse files
Test improvements.
1 parent ae37b6e commit 575ca43

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

tests/test_2700_aq.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ def test_2716_payloadType_deprecation(self):
426426
queue = self.connection.queue(self.book_queue_name,
427427
payloadType=books_type)
428428
self.assertEqual(queue.payload_type, books_type)
429+
self.assertEqual(queue.payloadType, books_type)
429430
self.assertRaisesRegex(oracledb.ProgrammingError, "^DPY-2014:",
430431
self.connection.queue, self.book_queue_name,
431432
books_type, payloadType=books_type)
@@ -475,8 +476,8 @@ def test_2719_recipients_list(self):
475476
props1 = queue.deqone()
476477
self.assertTrue(props1 is None)
477478

478-
def test_2720_aq_notification(self):
479-
"2720 - verify msgid of aq message which spawned notification "
479+
def test_2720_aq_message_attributes(self):
480+
"2720 - verify attributes of AQ message which spawned notification"
480481
if self.is_on_oracle_cloud(self.connection):
481482
self.skipTest("AQ notification not supported on the cloud")
482483
queue = self.get_and_clear_queue(self.book_queue_name,
@@ -486,7 +487,12 @@ def test_2720_aq_notification(self):
486487
def notification_callback(message):
487488
self.cursor.execute("select msgid from book_queue_tab")
488489
actual_msgid, = self.cursor.fetchone()
489-
self.assertEqual(actual_msgid, message.msgid)
490+
self.assertEqual(message.msgid, actual_msgid)
491+
self.assertEqual(message.consumer_name, None)
492+
main_user = test_env.get_main_user().upper()
493+
self.assertEqual(message.queue_name,
494+
f'"{main_user}"."{queue.name}"')
495+
self.assertEqual(message.type, oracledb.EVENT_AQ)
490496
with condition:
491497
condition.notify()
492498
sub = connection.subscribe(namespace=oracledb.SUBSCR_NAMESPACE_AQ,

tests/test_2800_bulk_aq.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#------------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -191,5 +191,20 @@ def test_2807_json_enq_deq(self):
191191
actual_data = [m.payload for m in messages]
192192
self.assertEqual(actual_data, JSON_DATA_PAYLOAD)
193193

194+
def test_2808_no_json_payload(self):
195+
"2808 - test enqueuing to a JSON queue without a JSON payload"
196+
queue = self.get_and_clear_queue(JSON_QUEUE_NAME, "JSON")
197+
props = self.connection.msgproperties(payload="string message")
198+
self.assertRaisesRegex(oracledb.DatabaseError, "^DPI-1071:",
199+
queue.enqmany, [props, props])
200+
201+
def test_2809_errors_for_invalid_values(self):
202+
"2809 - test errors for invalid values for enqmany and deqmany"
203+
queue = self.get_and_clear_queue(JSON_QUEUE_NAME, "JSON")
204+
props = self.connection.msgproperties(payload="string message")
205+
self.assertRaises(TypeError, queue.enqmany, props)
206+
self.assertRaises(TypeError, queue.enqmany, ["Not", "msgproperties"])
207+
self.assertRaises(TypeError, queue.deqmany, "5")
208+
194209
if __name__ == "__main__":
195210
test_env.run_test_cases()

0 commit comments

Comments
 (0)