# Testfixes
* fixes test cases
This commit is contained in:
		
							parent
							
								
									9a5ebb88a9
								
							
						
					
					
						commit
						d830b7f88b
					
				@ -54,7 +54,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
        post_data = {
 | 
					        post_data = {
 | 
				
			||||||
            "identifier": test_id,
 | 
					            "identifier": test_id,
 | 
				
			||||||
            "title": test_title,
 | 
					            "title": test_title,
 | 
				
			||||||
            "geom": geom_json,
 | 
					            "output": geom_json,
 | 
				
			||||||
            "intervention": self.intervention.id,
 | 
					            "intervention": self.intervention.id,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        pre_creation_intervention_log_count = self.intervention.log.count()
 | 
					        pre_creation_intervention_log_count = self.intervention.log.count()
 | 
				
			||||||
@ -94,7 +94,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
        post_data = {
 | 
					        post_data = {
 | 
				
			||||||
            "identifier": test_id,
 | 
					            "identifier": test_id,
 | 
				
			||||||
            "title": test_title,
 | 
					            "title": test_title,
 | 
				
			||||||
            "geom": geom_json,
 | 
					            "output": geom_json,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        pre_creation_intervention_log_count = self.intervention.log.count()
 | 
					        pre_creation_intervention_log_count = self.intervention.log.count()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -150,7 +150,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
            "title": new_title,
 | 
					            "title": new_title,
 | 
				
			||||||
            "intervention": self.intervention.id,  # just keep the intervention as it is
 | 
					            "intervention": self.intervention.id,  # just keep the intervention as it is
 | 
				
			||||||
            "comment": new_comment,
 | 
					            "comment": new_comment,
 | 
				
			||||||
            "geom": geojson,
 | 
					            "output": geojson,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        self.client_user.post(url, post_data)
 | 
					        self.client_user.post(url, post_data)
 | 
				
			||||||
        self.compensation.refresh_from_db()
 | 
					        self.compensation.refresh_from_db()
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
        post_data = {
 | 
					        post_data = {
 | 
				
			||||||
            "identifier": test_id,
 | 
					            "identifier": test_id,
 | 
				
			||||||
            "title": test_title,
 | 
					            "title": test_title,
 | 
				
			||||||
            "geom": geom_json,
 | 
					            "output": geom_json,
 | 
				
			||||||
            "surface": test_deductable_surface,
 | 
					            "surface": test_deductable_surface,
 | 
				
			||||||
            "conservation_office": test_conservation_office.id
 | 
					            "conservation_office": test_conservation_office.id
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -103,7 +103,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
            "identifier": new_identifier,
 | 
					            "identifier": new_identifier,
 | 
				
			||||||
            "title": new_title,
 | 
					            "title": new_title,
 | 
				
			||||||
            "comment": new_comment,
 | 
					            "comment": new_comment,
 | 
				
			||||||
            "geom": new_geometry.geojson,
 | 
					            "output": new_geometry.geojson,
 | 
				
			||||||
            "surface": test_deductable_surface,
 | 
					            "surface": test_deductable_surface,
 | 
				
			||||||
            "conservation_office": test_conservation_office.id
 | 
					            "conservation_office": test_conservation_office.id
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,7 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
        post_data = {
 | 
					        post_data = {
 | 
				
			||||||
            "identifier": test_id,
 | 
					            "identifier": test_id,
 | 
				
			||||||
            "title": test_title,
 | 
					            "title": test_title,
 | 
				
			||||||
            "geom": geom_json,
 | 
					            "output": geom_json,
 | 
				
			||||||
            "conservation_office": test_conservation_office.id
 | 
					            "conservation_office": test_conservation_office.id
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        self.client_user.post(new_url, post_data)
 | 
					        self.client_user.post(new_url, post_data)
 | 
				
			||||||
@ -99,7 +99,7 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
            "identifier": new_identifier,
 | 
					            "identifier": new_identifier,
 | 
				
			||||||
            "title": new_title,
 | 
					            "title": new_title,
 | 
				
			||||||
            "comment": new_comment,
 | 
					            "comment": new_comment,
 | 
				
			||||||
            "geom": new_geometry.geojson,
 | 
					            "output": new_geometry.geojson,
 | 
				
			||||||
            "conservation_office": test_conservation_office.id
 | 
					            "conservation_office": test_conservation_office.id
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        self.client_user.post(url, post_data)
 | 
					        self.client_user.post(url, post_data)
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,7 @@ class NewEmaFormTestCase(BaseTestCase):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
        geom_form_data = json.loads(geom_form_data)
 | 
					        geom_form_data = json.loads(geom_form_data)
 | 
				
			||||||
        geom_form_data = {
 | 
					        geom_form_data = {
 | 
				
			||||||
            "geom": json.dumps(geom_form_data)
 | 
					            "output": json.dumps(geom_form_data)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        geom_form = SimpleGeomForm(geom_form_data)
 | 
					        geom_form = SimpleGeomForm(geom_form_data)
 | 
				
			||||||
@ -116,7 +116,7 @@ class EditEmaFormTestCase(BaseTestCase):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
        geom_form_data = json.loads(geom_form_data)
 | 
					        geom_form_data = json.loads(geom_form_data)
 | 
				
			||||||
        geom_form_data = {
 | 
					        geom_form_data = {
 | 
				
			||||||
            "geom": json.dumps(geom_form_data)
 | 
					            "output": json.dumps(geom_form_data)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        geom_form = SimpleGeomForm(geom_form_data)
 | 
					        geom_form = SimpleGeomForm(geom_form_data)
 | 
				
			||||||
 | 
				
			|||||||
@ -60,7 +60,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
 | 
				
			|||||||
        post_data = {
 | 
					        post_data = {
 | 
				
			||||||
            "identifier": test_id,
 | 
					            "identifier": test_id,
 | 
				
			||||||
            "title": test_title,
 | 
					            "title": test_title,
 | 
				
			||||||
            "geom": geom_json,
 | 
					            "output": geom_json,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        response = self.client_user.post(
 | 
					        response = self.client_user.post(
 | 
				
			||||||
            new_url,
 | 
					            new_url,
 | 
				
			||||||
 | 
				
			|||||||
@ -62,7 +62,7 @@ class NewInterventionFormTestCase(BaseTestCase):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
        geom_form_data = json.loads(geom_form_data)
 | 
					        geom_form_data = json.loads(geom_form_data)
 | 
				
			||||||
        geom_form_data = {
 | 
					        geom_form_data = {
 | 
				
			||||||
            "geom": json.dumps(geom_form_data)
 | 
					            "output": json.dumps(geom_form_data)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        geom_form = SimpleGeomForm(geom_form_data)
 | 
					        geom_form = SimpleGeomForm(geom_form_data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -104,7 +104,7 @@ class EditInterventionFormTestCase(NewInterventionFormTestCase):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
        geom_form_data = json.loads(geom_form_data)
 | 
					        geom_form_data = json.loads(geom_form_data)
 | 
				
			||||||
        geom_form_data = {
 | 
					        geom_form_data = {
 | 
				
			||||||
            "geom": json.dumps(geom_form_data)
 | 
					            "output": json.dumps(geom_form_data)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        geom_form = SimpleGeomForm(geom_form_data)
 | 
					        geom_form = SimpleGeomForm(geom_form_data)
 | 
				
			||||||
 | 
				
			|||||||
@ -62,7 +62,7 @@ class SimpleGeomForm(BaseForm):
 | 
				
			|||||||
        is_valid = True
 | 
					        is_valid = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Get geojson from form
 | 
					        # Get geojson from form
 | 
				
			||||||
        geom = self.data["output"]
 | 
					        geom = self.data.get("output", None)
 | 
				
			||||||
        if geom is None or len(geom) == 0:
 | 
					        if geom is None or len(geom) == 0:
 | 
				
			||||||
            # empty geometry is a valid geometry
 | 
					            # empty geometry is a valid geometry
 | 
				
			||||||
            self.cleaned_data["output"] = MultiPolygon(srid=DEFAULT_SRID_RLP).ewkt
 | 
					            self.cleaned_data["output"] = MultiPolygon(srid=DEFAULT_SRID_RLP).ewkt
 | 
				
			||||||
@ -71,7 +71,7 @@ class SimpleGeomForm(BaseForm):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        # Write submitted data back into form field to make sure invalid geometry
 | 
					        # Write submitted data back into form field to make sure invalid geometry
 | 
				
			||||||
        # will be rendered again on failed submit
 | 
					        # will be rendered again on failed submit
 | 
				
			||||||
        self.initialize_form_field("output", self.data["output"])
 | 
					        self.initialize_form_field("output", self.data.get("output", None))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Read geojson into gdal geometry
 | 
					        # Read geojson into gdal geometry
 | 
				
			||||||
        # HINT: This can be simplified if the geojson format holds data in epsg:4326 (GDAL provides direct creation for
 | 
					        # HINT: This can be simplified if the geojson format holds data in epsg:4326 (GDAL provides direct creation for
 | 
				
			||||||
 | 
				
			|||||||
@ -124,6 +124,7 @@ class GeometryTestCase(BaseTestCase):
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    "type": "Feature",
 | 
					                    "type": "Feature",
 | 
				
			||||||
                    "geometry": json.loads(p.json),
 | 
					                    "geometry": json.loads(p.json),
 | 
				
			||||||
 | 
					                    "properties": {},
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                for p in polygons
 | 
					                for p in polygons
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
				
			|||||||
@ -345,6 +345,7 @@ class BaseTestCase(TestCase):
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    "type": "Feature",
 | 
					                    "type": "Feature",
 | 
				
			||||||
                    "geometry": json.loads(geometry.geojson),
 | 
					                    "geometry": json.loads(geometry.geojson),
 | 
				
			||||||
 | 
					                    "properties": {},
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,7 @@
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		"projection": "EPSG:25832",
 | 
							"projection": "EPSG:25832",
 | 
				
			||||||
		"center_lonlat": [ 7.0, 50.0 ],
 | 
							"center_lonlat": [ 7.0, 50.0 ],
 | 
				
			||||||
		"zoom": 12,
 | 
							"zoom": 9.2,
 | 
				
			||||||
		"min_zoom": 5,
 | 
							"min_zoom": 5,
 | 
				
			||||||
		"max_zoom": 24,
 | 
							"max_zoom": 24,
 | 
				
			||||||
		"scalebar": true,
 | 
							"scalebar": true,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user