From 5d8706c2614eeef96103c4ad8af8c6fa365a0677 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 22 Mar 2024 12:17:23 +0100 Subject: [PATCH] chore: remove Permissions tests from JS and update PW ones --- umap/static/umap/test/Permissions.js | 74 ------------------- umap/static/umap/test/index.html | 1 - .../integration/test_anonymous_owned_map.py | 3 + 3 files changed, 3 insertions(+), 75 deletions(-) delete mode 100644 umap/static/umap/test/Permissions.js diff --git a/umap/static/umap/test/Permissions.js b/umap/static/umap/test/Permissions.js deleted file mode 100644 index 979dcd03..00000000 --- a/umap/static/umap/test/Permissions.js +++ /dev/null @@ -1,74 +0,0 @@ -describe('L.Permissions', function () { - var path = '/map/99/datalayer/edit/62/' - - before(function () { - this.server = sinon.fakeServer.create() - this.server.respondWith( - /\/datalayer\/62\/\?.*/, - JSON.stringify(RESPONSES.datalayer62_GET) - ) - this.map = initMap({ umap_id: 99 }) - this.datalayer = this.map.getDataLayerByUmapId(62) - this.server.respond() - enableEdit() - }) - after(function () { - clickCancel() - this.server.restore() - resetMap() - }) - - describe('#open()', function () { - var button - - it('should exist update permissions link', function () { - button = qs('a.update-map-permissions') - expect(button).to.be.ok - }) - - it('should open table button click', function () { - happen.click(button) - expect(qs('.permissions-panel')).to.be.ok - }) - }) - describe('#anonymous with cookie', function () { - var button - - it('should not allow share_status nor owner', function () { - this.map.permissions.options.anonymous_edit_url = 'http://anonymous.url' - delete this.map.options.permissions.owner - button = qs('a.update-map-permissions') - happen.click(button) - expect(qs('select[name="share_status"]')).not.to.be.ok - expect(qs('input.edit-owner')).not.to.be.ok - }) - }) - - describe('#editor', function () { - var button - - it('should only allow editors', function () { - this.map.options.permissions.owner = { id: 1, url: '/url', name: 'jojo' } - delete this.map.options.permissions.anonymous_edit_url - delete this.map.options.user - button = qs('a.update-map-permissions') - happen.click(button) - expect(qs('select[name="share_status"]')).not.to.be.ok - expect(qs('input.edit-owner')).not.to.be.ok - expect(qs('input.edit-editors')).to.be.ok - }) - }) - - describe('#owner', function () { - var button - - it('should allow everything', function () { - this.map.permissions.options.owner = { id: 1, url: '/url', name: 'jojo' } - this.map.options.user = { id: 1, url: '/url', name: 'jojo' } - button = qs('a.update-map-permissions') - happen.click(button) - expect(qs('input.edit-owner')).to.be.ok - expect(qs('input.edit-editors')).to.be.ok - }) - }) -}) diff --git a/umap/static/umap/test/index.html b/umap/static/umap/test/index.html index a4131574..8ab2c567 100644 --- a/umap/static/umap/test/index.html +++ b/umap/static/umap/test/index.html @@ -95,7 +95,6 @@ -