Update changelog and add another ut case

This commit is contained in:
Eddie Linder 2019-01-11 19:23:47 +02:00
parent 56d9f7a8af
commit c6c68abfcc
2 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,7 @@ Development
=========== ===========
- (Fill this out as you fix issues and develop your features). - (Fill this out as you fix issues and develop your features).
- Fix .only() working improperly after using .count() of the same instance of QuerySet - Fix .only() working improperly after using .count() of the same instance of QuerySet
- POTENTIAL BREAKING CHANGE: All result fields are now passed, including internal fields (_cls, _id) when using `QuerySet.as_pymongo` #1976
================= =================
Changes in 0.16.3 Changes in 0.16.3

View File

@ -4709,19 +4709,22 @@ class QuerySetTest(unittest.TestCase):
serialized_user = User.objects.exclude( serialized_user = User.objects.exclude(
'password_salt', 'password_hash').as_pymongo()[0] 'password_salt', 'password_hash').as_pymongo()[0]
self.assertEqual(set(['_id', 'email']), set(serialized_user.keys())) self.assertEqual({'_id', 'email'}, set(serialized_user.keys()))
serialized_user = User.objects.exclude( serialized_user = User.objects.exclude(
'id', 'password_salt', 'password_hash').to_json() 'id', 'password_salt', 'password_hash').to_json()
self.assertEqual('[{"email": "ross@example.com"}]', serialized_user) self.assertEqual('[{"email": "ross@example.com"}]', serialized_user)
serialized_user = User.objects.only('email').as_pymongo()[0]
self.assertEqual({'_id', 'email'}, set(serialized_user.keys()))
serialized_user = User.objects.exclude( serialized_user = User.objects.exclude(
'password_salt').only('email').as_pymongo()[0] 'password_salt').only('email').as_pymongo()[0]
self.assertEqual(set(['_id', 'email']), set(serialized_user.keys())) self.assertEqual({'_id', 'email'}, set(serialized_user.keys()))
serialized_user = User.objects.exclude( serialized_user = User.objects.exclude(
'password_salt', 'id').only('email').as_pymongo()[0] 'password_salt', 'id').only('email').as_pymongo()[0]
self.assertEqual(set(['email']), set(serialized_user.keys())) self.assertEqual({'email'}, set(serialized_user.keys()))
serialized_user = User.objects.exclude( serialized_user = User.objects.exclude(
'password_salt', 'id').only('email').to_json() 'password_salt', 'id').only('email').to_json()