additional fixes to support Mongo3.4

This commit is contained in:
Bastien Gérard
2019-02-24 22:34:17 +01:00
parent dca837b843
commit 7247b9b68e
5 changed files with 15 additions and 9 deletions

View File

@@ -603,18 +603,24 @@ class IndexesTest(unittest.TestCase):
@requires_mongodb_gte_34
def test_primary_key_unique_not_working_under_mongo_34(self):
"""Relates to #1445"""
class Blog(Document):
id = StringField(primary_key=True, unique=True)
Blog.drop_collection()
with self.assertRaises(OperationFailure) as ctx_err:
Blog(id='garbage').save()
self.assertIn("The field 'unique' is not valid for an _id index specification", str(ctx_err.exception))
@requires_mongodb_lte_32
def test_primary_key_unique_working_under_mongo_32(self):
"""Relates to #1445"""
class Blog(Document):
id = StringField(primary_key=True, unique=True)
Blog.drop_collection()
Blog(id='garbage').save()
def test_unique_with(self):