Commit 9fc8c200 authored by Aurélien Lubert's avatar Aurélien Lubert
Browse files

test(pyramid/predicates): Add tests to check entity view without guest account

* Validate changeset f3b46587ea1f by testing if an entity view return a 403
  status error for guests when the cubicweb instance do not allowed anonymous
parent 5cdf544679cc
Pipeline #66794 passed with stages
in 39 minutes and 35 seconds
......@@ -5,6 +5,28 @@ def simple_test_view(request):
return request.response
class AnonymousDisallowedPredicatesTC(PyramidCWTest):
anonymous_allowed = False
settings = {"cubicweb.bwcompat": True}
def includeme(self, config):
config.add_route("view-entity", r"/{eid}", has_cw_permission="read")
config.add_view(simple_test_view, route_name="view-entity")
def setUp(self):
super(AnonymousDisallowedPredicatesTC, self).setUp()
with self.admin_access.repo_cnx() as cnx:
self.eid = self.create_user(cnx, "Fernestin").eid
def test_view_entity_without_connection(self):
self.webapp.get(f"/{self.eid}", status=403)
def test_view_entity_with_connection(self):
self.webapp.get(f"/{self.eid}", status=200)
class PredicatesTC(PyramidCWTest):
def includeme(self, config):
# to test route predicate
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment