def test_put_success_all(self):
        body = {
            'message': 'Update',
            'document': {
                'document_id': self.map1.document_id,
                'version': self.map1.version,
                'quality': quality_types[1],
                'editor': 'IGN',
                'scale': '25000',
                'code': '3433OT',
                'geometry': {
                    'version': self.map1.geometry.version,
                    'geom_detail': '{"type":"Polygon","coordinates":[[[668519.249382151,5728802.39591739],[668518.249382151,5745465.66808356],[689156.247019149,5745465.66808356],[689156.247019149,5728802.39591739],[668519.249382151,5728802.39591739]]]}'  # noqa
                },
                'locales': [
                    {'lang': 'en', 'title': 'New title',
                     'version': self.locale_en.version}
                ]
            }
        }
        (body, map1) = self.put_success_all(body, self.map1, user='moderator')

        self.assertEqual(map1.code, '3433OT')
        locale_en = map1.get_locale('en')
        self.assertEqual(locale_en.title, 'New title')

        # version with lang 'en'
        versions = map1.versions
        version_en = self.get_latest_version('en', versions)
        archive_locale = version_en.document_locales_archive
        self.assertEqual(archive_locale.title, 'New title')

        archive_document_en = version_en.document_archive
        self.assertEqual(archive_document_en.scale, '25000')
        self.assertEqual(archive_document_en.code, '3433OT')

        archive_geometry_en = version_en.document_geometry_archive
        self.assertEqual(archive_geometry_en.version, 2)

        # version with lang 'fr'
        version_fr = self.get_latest_version('fr', versions)
        archive_locale = version_fr.document_locales_archive
        self.assertEqual(archive_locale.title, 'Lac d\'Annecy')

        # check that the links to intersecting documents are updated
        links = self.session.query(TopoMapAssociation). \
            filter(
                TopoMapAssociation.topo_map_id == self.map1.document_id). \
            all()
        self.assertEqual(len(links), 2)
        self.assertEqual(links[0].document_id, self.waypoint1.document_id)
        self.check_cache_version(self.waypoint1.document_id, 2)
        self.assertEqual(links[1].document_id, self.route.document_id)
        self.check_cache_version(self.route.document_id, 2)
        # waypoint 2 is no longer associated, the cache key was incremented
        self.check_cache_version(self.waypoint2.document_id, 2)