Added test for Geo indexes
This commit is contained in:
		@@ -6,7 +6,7 @@ Changes in v0.4
 | 
			
		||||
===============
 | 
			
		||||
- Added ``SortedListField``
 | 
			
		||||
- Added ``EmailField``
 | 
			
		||||
- Added ``GeoLocationField``
 | 
			
		||||
- Added ``GeoPointField``
 | 
			
		||||
- Added ``exact`` and ``iexact`` match operators to ``QuerySet``
 | 
			
		||||
- Added ``get_document_or_404`` and ``get_list_or_404`` Django shortcuts
 | 
			
		||||
- Fixed bug in Q-objects
 | 
			
		||||
 
 | 
			
		||||
@@ -607,6 +607,24 @@ class FieldTest(unittest.TestCase):
 | 
			
		||||
 | 
			
		||||
        Shirt.drop_collection()
 | 
			
		||||
 | 
			
		||||
    def test_geo_indexes(self):
 | 
			
		||||
        """Ensure that indexes are created automatically for GeoPointFields.
 | 
			
		||||
        """
 | 
			
		||||
        class Event(Document):
 | 
			
		||||
            title = StringField()
 | 
			
		||||
            location = GeoPointField()
 | 
			
		||||
 | 
			
		||||
        Event.drop_collection()
 | 
			
		||||
        event = Event(title="Coltrane Motion @ Double Door",
 | 
			
		||||
                      location=[41.909889, -87.677137])
 | 
			
		||||
        event.save()
 | 
			
		||||
 | 
			
		||||
        info = Event.objects._collection.index_information()
 | 
			
		||||
        self.assertTrue(u'location_2d' in info)
 | 
			
		||||
        self.assertTrue(info[u'location_2d'] == [(u'location', u'2d')])
 | 
			
		||||
 | 
			
		||||
        Event.drop_collection()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -1175,8 +1175,6 @@ class QuerySetTest(unittest.TestCase):
 | 
			
		||||
            def __unicode__(self):
 | 
			
		||||
                return self.title
 | 
			
		||||
            
 | 
			
		||||
            meta = {'geo_indexes': ["location"]}
 | 
			
		||||
        
 | 
			
		||||
        Event.drop_collection()
 | 
			
		||||
        
 | 
			
		||||
        event1 = Event(title="Coltrane Motion @ Double Door",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user