def test_web_paths_security_info(self): path_infos = inspector.web_paths_security_info('web_stub') expected_paths = ['/pack_stub/stub/adm', '/pack_stub/stub/adm_or_manager', '/pack_stub/stub/manager', '/pack_stub/stub/sysowner', '/pack_stub', '/'] expected_groups = ['ADMIN', 'ADMIN, MANAGER', 'MANAGER', 'SYS_OWNER', 'Permission not Required', 'Login not Required'] expected_csrf = [True, True, True, True, False, False] for exp_path_info, exp_path, exp_groups, exp_csrf in izip(path_infos, expected_paths, expected_groups, expected_csrf): self.assertEqual(exp_path, exp_path_info.path) self.assertEqual(exp_groups, exp_path_info.groups) self.assertEqual(exp_csrf, exp_path_info.csrf)
def test_web_paths_security_info(self): path_infos = [(t.path, t.groups, t.csrf) for t in inspector.web_paths_security_info('routes')] expected_paths = ['/pack_stub/stub/adm', '/pack_stub/stub/adm_or_manager', '/pack_stub/stub/manager', '/pack_stub/stub/sysowner', '/pack_stub', '/'] expected_groups = ['ADMIN', 'ADMIN, MANAGER', 'MANAGER', 'SYS_OWNER', 'Login Required', 'Login not Required'] expected_csrf = [True, True, True, True, False, False] expected_path_infos = zip(expected_paths, expected_groups, expected_csrf) expected_path_infos.sort(key=lambda e: e[0]) path_infos.sort(key=lambda e: e[0]) self.assertListEqual(expected_path_infos, path_infos)
def web_path_security_info(): """ Returns a generator that returns all paths from the application if information about groups and csrf security """ return inspector.web_paths_security_info(router.package_base)