update test case for: Please recall fix on: Saving document doesn't create new fields in existing collection #620 #1126
This commit is contained in:
parent
eb8176971c
commit
3fe93968a6
@ -2941,6 +2941,17 @@ class InstanceTest(unittest.TestCase):
|
|||||||
p4 = Person.objects()[0]
|
p4 = Person.objects()[0]
|
||||||
p4.save()
|
p4.save()
|
||||||
self.assertEquals(p4.height, 189)
|
self.assertEquals(p4.height, 189)
|
||||||
|
|
||||||
|
# However the default will not be fixed in DB
|
||||||
|
self.assertEquals(Person.objects(height=189).count(), 0)
|
||||||
|
|
||||||
|
# alter DB for the new default
|
||||||
|
coll = Person._get_collection()
|
||||||
|
for person in Person.objects.as_pymongo():
|
||||||
|
if 'height' not in person:
|
||||||
|
person['height'] = 189
|
||||||
|
coll.save(person)
|
||||||
|
|
||||||
self.assertEquals(Person.objects(height=189).count(), 1)
|
self.assertEquals(Person.objects(height=189).count(), 1)
|
||||||
|
|
||||||
def test_from_son(self):
|
def test_from_son(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user