'Verify that Layer.set_default_permissions is behaving as expected'

def test_layer_set_default_permissions(self):

    layer = Layer.objects.all()[0]
    layer.set_default_permissions()
    self.assertTrue(self.anonymous_user.has_perm('view_resourcebase', layer.get_self_resource()))
    self.assertTrue(layer.owner.has_perm('view_resourcebase', layer.get_self_resource()))
    self.assertTrue(layer.owner.has_perm('download_resourcebase', layer.get_self_resource()))
    self.assertTrue(layer.owner.has_perm('change_resourcebase_metadata', layer.get_self_resource()))
    if (layer.storeType == 'dataStore'):
        self.assertTrue(layer.owner.has_perm('change_layer_data', layer))
    self.assertTrue(layer.owner.has_perm('change_layer_style', layer))
    self.assertTrue(layer.owner.has_perm('change_resourcebase', layer.get_self_resource()))
    self.assertTrue(layer.owner.has_perm('delete_resourcebase', layer.get_self_resource()))
    self.assertTrue(layer.owner.has_perm('change_resourcebase_permissions', layer.get_self_resource()))
    self.assertTrue(layer.owner.has_perm('publish_resourcebase', layer.get_self_resource()))
