def test_is_permitted_host_false(
     self,
     monkeypatch,
     module_wide_request_context,
     created_host_url,
 ):
     monkeypatch.setattr(
         hosts_and_folders.config.user,
         "may",
         lambda pname: False,
     )
     assert not URLChecker().is_permitted(created_host_url)
Example #2
0
 def test_is_permitted_host_false(
     self,
     monkeypatch: MonkeyPatch,
     request_context,
     created_host_url: str,
 ) -> None:
     monkeypatch.setattr(
         user,
         "may",
         lambda pname: False,
     )
     assert not URLChecker().is_permitted(created_host_url)
Example #3
0
 def test_is_permitted_host_true(
     self,
     created_host_url: str,
 ) -> None:
     assert URLChecker().is_permitted(created_host_url)
Example #4
0
 def test_is_permitted_true(self) -> None:
     assert URLChecker().is_permitted("wato.py?folder=&mode=service_groups")
 def test_is_permitted_true(self, with_admin_login):
     assert URLChecker().is_permitted("wato.py?folder=&mode=service_groups")
 def test_is_permitted_false(self, module_wide_request_context):
     assert not URLChecker().is_permitted(
         "wato.py?folder=&mode=service_groups")
Example #7
0
 def test_search_no_index(self) -> None:
     with pytest.raises(IndexNotFoundException):
         list(
             IndexSearcher(PermissionsHandler(
                 URLChecker(ModeEditHost))).search("change_dep"))