get_mongodb_version tests helper + fix indexing tests in mongodb v2.4

This commit is contained in:
Stefan Wojcik
2017-02-25 20:21:20 -05:00
parent d39f5197cb
commit 71ccfeac3c
4 changed files with 23 additions and 14 deletions

View File

@@ -603,12 +603,13 @@ class QuerySetTest(unittest.TestCase):
class Scores(Document):
high_score = IntField()
low_score = IntField()
scores = Scores(high_score=800, low_score=200)
scores.save()
scores = Scores.objects.create(high_score=800, low_score=200)
Scores.objects(id=scores.id).update(min__low_score=150)
self.assertEqual(Scores.objects(id=scores.id).get().low_score, 150)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 150)
Scores.objects(id=scores.id).update(min__low_score=250)
self.assertEqual(Scores.objects(id=scores.id).get().low_score, 150)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 150)
def test_updates_can_have_match_operators(self):