'Test that layer detail gives 401 when not public and not logged in'

def test_layer_get_detail_unauth_layer_not_public(self):

    layer = Layer.objects.all()[0]
    layer.set_permissions(self.perm_spec)
    self.assertHttpUnauthorized(self.api_client.get(((self.list_url + str(layer.id)) + '/')))
    self.api_client.client.login(username=self.user, password=self.passwd)
    resp = self.api_client.get(((self.list_url + str(layer.id)) + '/'))
    self.assertValidJSONResponse(resp)
