diff --git a/c2corg_api/tests/scripts/users/test_merge.py b/c2corg_api/tests/scripts/users/test_merge.py index bb8a70332..b721d0b6d 100644 --- a/c2corg_api/tests/scripts/users/test_merge.py +++ b/c2corg_api/tests/scripts/users/test_merge.py @@ -14,6 +14,8 @@ from c2corg_api.models.route import Route, RouteLocale, ROUTE_TYPE from c2corg_api.models.sso import SsoExternalId from c2corg_api.models.token import Token +from c2corg_api.models.topo_map import TopoMap +from c2corg_api.models.topo_map_association import TopoMapAssociation from c2corg_api.models.user import User from c2corg_api.models.user_profile import UserProfile, ArchiveUserProfile, \ USERPROFILE_TYPE @@ -194,6 +196,20 @@ def _add_test_data(self): document=self.contributor.profile, area=area)) self.session.flush() + self.map1 = TopoMap( + code='3232ET', editor='IGN', scale='25000', + locales=[ + DocumentLocale(lang='fr', title='Belley') + ], + geometry=DocumentGeometry(geom_detail='SRID=3857;POLYGON((611774.917032556 5706934.10657514,611774.917032556 5744215.5846397,642834.402570357 5744215.5846397,642834.402570357 5706934.10657514,611774.917032556 5706934.10657514))') # noqa + ) + self.session.add(self.map1) + self.session.flush() + self.session.add(TopoMapAssociation( + document=self.contributor.profile, + topo_map=self.map1)) + self.session.flush() + self.waypoint1 = Waypoint( waypoint_type='summit', elevation=2203, locales=[WaypointLocale(lang='en', title='Mont Granier')], diff --git a/c2corg_api/views/document_delete.py b/c2corg_api/views/document_delete.py index f5fed2cc5..d061fdb88 100644 --- a/c2corg_api/views/document_delete.py +++ b/c2corg_api/views/document_delete.py @@ -335,6 +335,7 @@ def remove_whole_document(document_id, clazz, clazz_locale, _remove_locale(clazz_locale, document_id) _remove_geometry(document_id) _remove_figures(clazz, document_id) + _remove_associations(document_id) # When all references have been deleted, finally remove the main # document entry: _remove_document(document_id)