Skip to content

Commit

Permalink
- GeoFence rules checks on test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Sep 26, 2018
1 parent 32fbe42 commit 4eff1b6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions geonode/security/tests.py
Expand Up @@ -390,6 +390,12 @@ def test_not_superuser_permissions(self):
'change_resourcebase_permissions',
layer.get_self_resource()))

if check_ogc_backend(geoserver.BACKEND_PACKAGE):
# Check GeoFence Rules have been correctly created
geofence_rules_count = get_geofence_rules_count()
_log("1. geofence_rules_count: %s " % geofence_rules_count)
self.assertTrue(geofence_rules_count == 1)

self.assertTrue(self.client.login(username='bobby', password='bob'))

# 1. view_resourcebase
Expand Down Expand Up @@ -455,6 +461,16 @@ def test_not_superuser_permissions(self):
response = self.client.get(reverse('layer_metadata', args=(layer.alternate,)))
self.assertEquals(response.status_code, 200)

if check_ogc_backend(geoserver.BACKEND_PACKAGE):
perms = get_users_with_perms(layer)
_log("2. perms: %s " % perms)
sync_geofence_with_guardian(layer, perms, user=bob, group=anonymous_group)

# Check GeoFence Rules have been correctly created
geofence_rules_count = get_geofence_rules_count()
_log("3. geofence_rules_count: %s " % geofence_rules_count)
self.assertTrue(geofence_rules_count == 3)

# 5. change_resourcebase_permissions
# should be impossible for the user without change_resourcebase_permissions
# to change permissions as the permission form is not available in the
Expand Down

0 comments on commit 4eff1b6

Please sign in to comment.