Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure to clear associations first? #1117

Merged
merged 2 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions c2corg_api/tests/scripts/users/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')],
Expand Down
1 change: 1 addition & 0 deletions c2corg_api/views/document_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down