PYTHON-1145 RS client obeys "uuidRepresentation=".

This commit is contained in:
A. Jesse Jiryu Davis 2016-09-19 17:19:06 -04:00
parent d172aeb542
commit c7c352ff3d
3 changed files with 17 additions and 1 deletions

View File

@ -653,7 +653,9 @@ class MongoReplicaSetClient(common.BaseObject):
'max_pool_size', max_pool_size))
common.validate_boolean('tz_aware', tz_aware)
uuid_representation = options.pop('uuidrepresentation', PYTHON_LEGACY)
uuid_representation = self.__opts.pop('uuidrepresentation',
PYTHON_LEGACY)
self.__opts['codec_options'] = CodecOptions(
document_class, tz_aware, uuid_representation)

View File

@ -1125,6 +1125,12 @@ with client.start_request() as request:
collection.find_one()
cursor.close()
def test_uuid_representation_kwarg(self):
client = MongoClient(uuidRepresentation='javaLegacy',
connect=False)
self.assertEqual(client.uuid_subtype, JAVA_LEGACY)
class TestClientLazyConnect(unittest.TestCase, _TestLazyConnectMixin):
def _get_client(self, **kwargs):

View File

@ -33,6 +33,7 @@ sys.path[0:0] = [""]
from nose.plugins.skip import SkipTest
from bson import JAVA_LEGACY
from bson.son import SON
from bson.tz_util import utc
from pymongo.mongo_client import MongoClient
@ -1268,6 +1269,13 @@ class TestReplicaSetClient(TestReplicaSetClientBase, TestRequestMixin):
finally:
ctx.exit()
def test_uuid_representation_kwarg(self):
client = MongoReplicaSetClient(uuidRepresentation='javaLegacy',
replicaSet='rs',
connect=False)
self.assertEqual(client.uuid_subtype, JAVA_LEGACY)
class TestReplicaSetWireVersion(unittest.TestCase):
def test_wire_version(self):