def test_create_new_mapstory(self): user = User.objects.create_user(username='******', email='*****@*****.**', password='******') mapstory = MapStory() self.assertIsInstance(mapstory, MapStory) mapstory.title = "Test story" mapstory.owner = user mapstory.save()
def add_mapstory(self): mapstory = MapStory() mapstory.name = "test_case1" mapstory.owner = self.admin_user mapstory.uuid = str(uuid.uuid1()) mapstory.save() map = Map() map.story = mapstory map.chapter_index = 0 map.title = "test_case" map.projection = 'EPSG:4326' map.owner = mapstory.owner map.uuid = str(uuid.uuid1()) map.zoom = 4 map.center_x = 0 map.center_y = 0 map.set_bounds_from_center_and_zoom( map.center_x, map.center_y, map.zoom) map.save() mapstory.chapter_list.add(map) mapstory.save() # background maplayer_background = MapLayer() maplayer_background.map = map maplayer_background.name = "control-room" maplayer_background.stack_order = 4 maplayer_background.opacity = 1.0 maplayer_background.fixed = False maplayer_background.visibility = True maplayer_background.source_params = u'{"hidden": true, "ptype": "gxp_mapboxsource"}' maplayer_background.layer_config = "" maplayer_background.group = "background" maplayer_background.save() # map.layers.add(maplayer) map.save() return mapstory
def add_mapstory(self): mapstory = MapStory() mapstory.name = "test_case1" mapstory.owner = self.admin_user mapstory.uuid = str(uuid.uuid1()) mapstory.save() map = Map() map.story = mapstory map.chapter_index = 0 map.title = "test_case" map.projection = 'EPSG:4326' map.owner = mapstory.owner map.uuid = str(uuid.uuid1()) map.zoom = 4 map.center_x = 0 map.center_y = 0 map.set_bounds_from_center_and_zoom(map.center_x, map.center_y, map.zoom) map.save() mapstory.chapter_list.add(map) mapstory.save() # background maplayer_background = MapLayer() maplayer_background.map = map maplayer_background.name = "control-room" maplayer_background.stack_order = 4 maplayer_background.opacity = 1.0 maplayer_background.fixed = False maplayer_background.visibility = True maplayer_background.source_params = u'{"hidden": true, "ptype": "gxp_mapboxsource"}' maplayer_background.layer_config = "" maplayer_background.group = "background" maplayer_background.save() # map.layers.add(maplayer) map.save() return mapstory