Makes the tests compatible to pymongo 1.7+. Not backwards compatible!
This commit is contained in:
parent
d3495896fa
commit
ec519f20fa
@ -264,11 +264,12 @@ class DocumentTest(unittest.TestCase):
|
|||||||
# Indexes are lazy so use list() to perform query
|
# Indexes are lazy so use list() to perform query
|
||||||
list(BlogPost.objects)
|
list(BlogPost.objects)
|
||||||
info = BlogPost.objects._collection.index_information()
|
info = BlogPost.objects._collection.index_information()
|
||||||
|
info = [value['key'] for key, value in info.iteritems()]
|
||||||
self.assertTrue([('_types', 1), ('category', 1), ('addDate', -1)]
|
self.assertTrue([('_types', 1), ('category', 1), ('addDate', -1)]
|
||||||
in info.values())
|
in info)
|
||||||
self.assertTrue([('_types', 1), ('addDate', -1)] in info.values())
|
self.assertTrue([('_types', 1), ('addDate', -1)] in info)
|
||||||
# tags is a list field so it shouldn't have _types in the index
|
# tags is a list field so it shouldn't have _types in the index
|
||||||
self.assertTrue([('tags', 1)] in info.values())
|
self.assertTrue([('tags', 1)] in info)
|
||||||
|
|
||||||
class ExtendedBlogPost(BlogPost):
|
class ExtendedBlogPost(BlogPost):
|
||||||
title = StringField()
|
title = StringField()
|
||||||
@ -278,10 +279,11 @@ class DocumentTest(unittest.TestCase):
|
|||||||
|
|
||||||
list(ExtendedBlogPost.objects)
|
list(ExtendedBlogPost.objects)
|
||||||
info = ExtendedBlogPost.objects._collection.index_information()
|
info = ExtendedBlogPost.objects._collection.index_information()
|
||||||
|
info = [value['key'] for key, value in info.iteritems()]
|
||||||
self.assertTrue([('_types', 1), ('category', 1), ('addDate', -1)]
|
self.assertTrue([('_types', 1), ('category', 1), ('addDate', -1)]
|
||||||
in info.values())
|
in info)
|
||||||
self.assertTrue([('_types', 1), ('addDate', -1)] in info.values())
|
self.assertTrue([('_types', 1), ('addDate', -1)] in info)
|
||||||
self.assertTrue([('_types', 1), ('title', 1)] in info.values())
|
self.assertTrue([('_types', 1), ('title', 1)] in info)
|
||||||
|
|
||||||
BlogPost.drop_collection()
|
BlogPost.drop_collection()
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ class FieldTest(unittest.TestCase):
|
|||||||
|
|
||||||
info = Event.objects._collection.index_information()
|
info = Event.objects._collection.index_information()
|
||||||
self.assertTrue(u'location_2d' in info)
|
self.assertTrue(u'location_2d' in info)
|
||||||
self.assertTrue(info[u'location_2d'] == [(u'location', u'2d')])
|
self.assertTrue(info[u'location_2d']['key'] == [(u'location', u'2d')])
|
||||||
|
|
||||||
Event.drop_collection()
|
Event.drop_collection()
|
||||||
|
|
||||||
|
@ -1087,8 +1087,9 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
# Indexes are lazy so use list() to perform query
|
# Indexes are lazy so use list() to perform query
|
||||||
list(BlogPost.objects)
|
list(BlogPost.objects)
|
||||||
info = BlogPost.objects._collection.index_information()
|
info = BlogPost.objects._collection.index_information()
|
||||||
self.assertTrue([('_types', 1)] in info.values())
|
info = [value['key'] for key, value in info.iteritems()]
|
||||||
self.assertTrue([('_types', 1), ('date', -1)] in info.values())
|
self.assertTrue([('_types', 1)] in info)
|
||||||
|
self.assertTrue([('_types', 1), ('date', -1)] in info)
|
||||||
|
|
||||||
BlogPost.drop_collection()
|
BlogPost.drop_collection()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user