Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/test_change_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,16 @@ def test_update_resume_token(self):
change = next(change_stream)
self.assertEqual(change['_id'], change_stream._resume_token)

@client_context.require_no_mongos # PYTHON-1739
def test_raises_error_on_missing_id(self):
"""ChangeStream will raise an exception if the server response is
missing the resume token.
"""
with self.coll.watch([{'$project': {'_id': 0}}]) as change_stream:
self.coll.insert_one({})
with self.assertRaises(InvalidOperation):
# Server returns an error after SERVER-37786, otherwise pymongo
# raises an error.
with self.assertRaises((InvalidOperation, OperationFailure)):
next(change_stream)
# The cursor should now be closed.
with self.assertRaises(StopIteration):
Expand Down