Skip to content

Commit

Permalink
PYTHON-2806 Fix test_aggregate_raw_transaction (#673)
Browse files Browse the repository at this point in the history
(cherry picked from commit da49bd8)
  • Loading branch information
ShaneHarvey committed Jul 12, 2021
1 parent e347299 commit 5714a93
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/test_cursor.py
Expand Up @@ -1494,10 +1494,13 @@ def test_find_raw_transaction(self):
session=session).sort('_id'))
cmd = listener.results['started'][0]
self.assertEqual(cmd.command_name, 'find')
self.assertEqual(cmd.command['$clusterTime'],
decode_all(session.cluster_time.raw)[0])
self.assertIn('$clusterTime', cmd.command)
self.assertEqual(cmd.command['startTransaction'], True)
self.assertEqual(cmd.command['txnNumber'], 1)
# Ensure we update $clusterTime from the command response.
last_cmd = listener.results['succeeded'][-1]
self.assertEqual(last_cmd.reply['$clusterTime']['clusterTime'],
session.cluster_time['clusterTime'])

self.assertEqual(1, len(batches))
self.assertEqual(docs, decode_all(batches[0]))
Expand Down Expand Up @@ -1688,9 +1691,13 @@ def test_aggregate_raw_transaction(self):
[{'$sort': {'_id': 1}}], session=session))
cmd = listener.results['started'][0]
self.assertEqual(cmd.command_name, 'aggregate')
self.assertEqual(cmd.command['$clusterTime'], session.cluster_time)
self.assertIn('$clusterTime', cmd.command)
self.assertEqual(cmd.command['startTransaction'], True)
self.assertEqual(cmd.command['txnNumber'], 1)
# Ensure we update $clusterTime from the command response.
last_cmd = listener.results['succeeded'][-1]
self.assertEqual(last_cmd.reply['$clusterTime']['clusterTime'],
session.cluster_time['clusterTime'])
self.assertEqual(1, len(batches))
self.assertEqual(docs, decode_all(batches[0]))

Expand Down

0 comments on commit 5714a93

Please sign in to comment.