Skip to content

Commit

Permalink
Added the test required by @ingenieroariel in GeoNode#134
Browse files Browse the repository at this point in the history
  • Loading branch information
capooti committed Nov 28, 2014
1 parent a965cf0 commit 9864684
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions geonode/tests/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,53 @@ def test_permissions(self):
# would be nice to make a WFS/T request and test results, but this
# would work only on PostGIS layers

# test change_layer_style
url = 'http://localhost:8000/gs/rest/styles/san_andres_y_providencia_poi.xml'
sld = """<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld"
xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<sld:NamedLayer>
<sld:Name>geonode:san_andres_y_providencia_poi</sld:Name>
<sld:UserStyle>
<sld:Name>san_andres_y_providencia_poi</sld:Name>
<sld:Title>san_andres_y_providencia_poi</sld:Title>
<sld:IsDefault>1</sld:IsDefault>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:PointSymbolizer>
<sld:Graphic>
<sld:Mark>
<sld:Fill>
<sld:CssParameter name="fill">#8A7700
</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name="stroke">#bbffff
</sld:CssParameter>
</sld:Stroke>
</sld:Mark>
<sld:Size>10</sld:Size>
</sld:Graphic>
</sld:PointSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>"""

# user without change_layer_style cannot edit it
c = Client()
c.login(username='norman', password='norman')
response = c.put(url, sld, content_type='application/vnd.ogc.sld+xml')
self.assertEquals(response.status_code, 401)

# user with change_layer_style can edit it
assign_perm('change_layer_style', norman, layer)
response = c.put(url, sld, content_type='application/vnd.ogc.sld+xml')
self.assertEquals(response.status_code, 200)

# Clean up and completely delete the layer
layer.delete()

Expand Down

0 comments on commit 9864684

Please sign in to comment.