Esempio n. 1
0
    def test_loader(self):
        RainappConfig(name="test", jdbcsource_id=0,
                      filter_id="test", slug="test").save()
        options = {
            'shapefile': resource_filename('lizard_rainapp',
                                           'shape/gemeenten2009.shp'),
            'id_field': 'ID',
            'name_field': 'NAME',
            'code_field': 'GEM_CODE',
            'x_field': 'X',
            'y_field': 'Y',
            'area_field': 'OPP',
            'slug': 'test',
        }

        def unexisting_filename():
            o = options.copy()
            o.update({'shapefile': 'wheeeeeeeeeeeeeeeeeeeeeeeeeee.xxx'})
            load_shapefile('section', o)
        self.assertRaises(ValueError, unexisting_filename)

        count = load_shapefile('section', options)
        self.assertEqual(GeoObject.objects.count(), count)
        self.assertEqual(452, count)
Esempio n. 2
0
 def unexisting_filename():
     o = options.copy()
     o.update({'shapefile': 'wheeeeeeeeeeeeeeeeeeeeeeeeeee.xxx'})
     load_shapefile('section', o)