Skip to content

Commit 85c1fcf

Browse files
committed
update tests
1 parent cc53b94 commit 85c1fcf

File tree

4 files changed

+69
-305
lines changed

4 files changed

+69
-305
lines changed

.evergreen/remove-unimplemented-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ rm $PYMONGO/test/connection_monitoring/wait-queue-fairness.json # PYTHON-1873
66
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-application-error.json # PYTHON-4918
77
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-checkout-error.json # PYTHON-4918
88
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-min-pool-size-error.json # PYTHON-4918
9+
rm $PYMONGO/test/client-side-encryption/spec/unified/client-bulkWrite-qe.json # PYTHON-4929
910

1011
# Python doesn't implement DRIVERS-3064
1112
rm $PYMONGO/test/collection_management/listCollections-rawdata.json

test/asynchronous/unified_format.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,42 @@ async def _databaseOperation_createCommandCursor(self, target, **kwargs):
787787

788788
return cursor
789789

790+
async def _collectionOperation_assertIndexExists(self, target, **kwargs):
791+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
792+
index_names = [idx["name"] async for idx in await collection.list_indexes()]
793+
self.assertIn(kwargs["index_name"], index_names)
794+
795+
async def _collectionOperation_assertIndexNotExists(self, target, **kwargs):
796+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
797+
async for index in await collection.list_indexes():
798+
self.assertNotEqual(kwargs["indexName"], index["name"])
799+
800+
async def _collectionOperation_assertCollectionExists(self, target, **kwargs):
801+
database_name = kwargs["database_name"]
802+
collection_name = kwargs["collection_name"]
803+
collection_name_list = list(
804+
await self.client.get_database(database_name).list_collection_names()
805+
)
806+
self.assertIn(collection_name, collection_name_list)
807+
808+
async def _databaseOperation_assertIndexExists(self, target, **kwargs):
809+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
810+
index_names = [idx["name"] async for idx in await collection.list_indexes()]
811+
self.assertIn(kwargs["index_name"], index_names)
812+
813+
async def _databaseOperation_assertIndexNotExists(self, target, **kwargs):
814+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
815+
async for index in await collection.list_indexes():
816+
self.assertNotEqual(kwargs["indexName"], index["name"])
817+
818+
async def _databaseOperation_assertCollectionExists(self, target, **kwargs):
819+
database_name = kwargs["database_name"]
820+
collection_name = kwargs["collection_name"]
821+
collection_name_list = list(
822+
await self.client.get_database(database_name).list_collection_names()
823+
)
824+
self.assertIn(collection_name, collection_name_list)
825+
790826
async def kill_all_sessions(self):
791827
if getattr(self, "client", None) is None:
792828
return

test/client-side-encryption/spec/unified/client-bulkWrite-qe.json

Lines changed: 0 additions & 305 deletions
This file was deleted.

test/unified_format.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,38 @@ def _databaseOperation_createCommandCursor(self, target, **kwargs):
784784

785785
return cursor
786786

787+
def _collectionOperation_assertIndexExists(self, target, **kwargs):
788+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
789+
index_names = [idx["name"] for idx in collection.list_indexes()]
790+
self.assertIn(kwargs["index_name"], index_names)
791+
792+
def _collectionOperation_assertIndexNotExists(self, target, **kwargs):
793+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
794+
for index in collection.list_indexes():
795+
self.assertNotEqual(kwargs["indexName"], index["name"])
796+
797+
def _collectionOperation_assertCollectionExists(self, target, **kwargs):
798+
database_name = kwargs["database_name"]
799+
collection_name = kwargs["collection_name"]
800+
collection_name_list = list(self.client.get_database(database_name).list_collection_names())
801+
self.assertIn(collection_name, collection_name_list)
802+
803+
def _databaseOperation_assertIndexExists(self, target, **kwargs):
804+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
805+
index_names = [idx["name"] for idx in collection.list_indexes()]
806+
self.assertIn(kwargs["index_name"], index_names)
807+
808+
def _databaseOperation_assertIndexNotExists(self, target, **kwargs):
809+
collection = self.client[kwargs["database_name"]][kwargs["collection_name"]]
810+
for index in collection.list_indexes():
811+
self.assertNotEqual(kwargs["indexName"], index["name"])
812+
813+
def _databaseOperation_assertCollectionExists(self, target, **kwargs):
814+
database_name = kwargs["database_name"]
815+
collection_name = kwargs["collection_name"]
816+
collection_name_list = list(self.client.get_database(database_name).list_collection_names())
817+
self.assertIn(collection_name, collection_name_list)
818+
787819
def kill_all_sessions(self):
788820
if getattr(self, "client", None) is None:
789821
return

0 commit comments

Comments
 (0)