Commit 7b3839a5 authored by Jérome Perrin's avatar Jérome Perrin

Fix logins not published

This addresses a regression from !1561 changing the class hierarchy caused Login to loose its docstring and became no longer publishable.

This was problematic because it was not detected by the test suite, so HTML test is changed to use zope publication instead of calling the view on the context.

Another notable point is that this behaves differently in ERP5JS, the Logins were still visible in ERP5JS. Because we don't actually rely on "no docstring on the class" to prevent publication, this is not changed.

See merge request !1571
parents 1a5c5ace abbe0362
......@@ -34,6 +34,8 @@ from Products.ERP5Type.XMLObject import XMLObject
class Login(EncryptedPasswordMixin, XMLObject, LoginAccountProviderMixin):
"""Login
"""
meta_type = 'ERP5 Login'
portal_type = 'Login'
add_permission = Permissions.AddPortalContent
......
......@@ -40,7 +40,8 @@ from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.exceptions import AccessControl_Unauthorized
class EncryptedPasswordMixin(object):
"""Encrypted Password Mixin
"""
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......
......@@ -6,28 +6,92 @@ portal_caches/erp5_content_medium/default_ram_cache
portal_caches/erp5_content_short
portal_caches/erp5_content_short/default_ram_cache
portal_caches/erp5_session_cache
portal_caches/erp5_session_cache/**
portal_caches/erp5_session_cache/2
portal_caches/erp5_ui_long
portal_caches/erp5_ui_long/default_ram_cache
portal_caches/erp5_ui_medium
portal_caches/erp5_ui_medium/default_ram_cache
portal_caches/erp5_ui_short
portal_caches/erp5_ui_short/default_ram_cache
portal_categories/action_type/*
portal_categories/callable_type/**
portal_categories/action_type/global
portal_categories/action_type/object_action
portal_categories/action_type/object_button
portal_categories/action_type/object_dialog
portal_categories/action_type/object_exchange
portal_categories/action_type/object_exchange_raw
portal_categories/action_type/object_fast_input
portal_categories/action_type/object_fast_input_raw
portal_categories/action_type/object_icon
portal_categories/action_type/object_jio_action
portal_categories/action_type/object_jio_action_raw
portal_categories/action_type/object_jio_button
portal_categories/action_type/object_jio_button_raw
portal_categories/action_type/object_jio_exchange
portal_categories/action_type/object_jio_exchange_raw
portal_categories/action_type/object_jio_fast_input
portal_categories/action_type/object_jio_fast_input_raw
portal_categories/action_type/object_jio_js_script
portal_categories/action_type/object_jio_jump
portal_categories/action_type/object_jio_jump_raw
portal_categories/action_type/object_jio_print
portal_categories/action_type/object_jio_print_raw
portal_categories/action_type/object_jio_report
portal_categories/action_type/object_jio_report_raw
portal_categories/action_type/object_jio_search
portal_categories/action_type/object_jio_view
portal_categories/action_type/object_jump
portal_categories/action_type/object_list
portal_categories/action_type/object_onlyjio_action
portal_categories/action_type/object_onlyjio_action_raw
portal_categories/action_type/object_onlyjio_button
portal_categories/action_type/object_onlyjio_button_raw
portal_categories/action_type/object_onlyjio_jump
portal_categories/action_type/object_onlyjio_jump_raw
portal_categories/action_type/object_onlyjio_view
portal_categories/action_type/object_onlyxhtml_view
portal_categories/action_type/object_print
portal_categories/action_type/object_print_raw
portal_categories/action_type/object_report
portal_categories/action_type/object_report_raw
portal_categories/action_type/object_search
portal_categories/action_type/object_view
portal_categories/action_type/object_web_view
portal_categories/action_type/workflow
portal_categories/callable_type/script
portal_categories/callable_type/script/diff_filter
portal_categories/constraint_type/audit
portal_categories/constraint_type/configuration
portal_categories/constraint_type/default
portal_categories/constraint_type/post_upgrade
portal_categories/constraint_type/pre_upgrade
portal_categories/constraint_type/upgrader
portal_categories/elementary_type/**
portal_categories/elementary_type/boolean
portal_categories/elementary_type/content
portal_categories/elementary_type/data
portal_categories/elementary_type/date
portal_categories/elementary_type/float
portal_categories/elementary_type/int
portal_categories/elementary_type/lines
portal_categories/elementary_type/long
portal_categories/elementary_type/multiple selection
portal_categories/elementary_type/object
portal_categories/elementary_type/selection
portal_categories/elementary_type/string
portal_categories/elementary_type/tales
portal_categories/elementary_type/text
portal_categories/elementary_type/tokens
portal_contribution_registry/default_predicate
portal_domains/base_day_domain
portal_domains/base_month_domain
portal_domains/base_week_domain
portal_domains/base_year_domain
portal_domains/parent_domain
portal_ids/**
portal_ids/1
portal_ids/2
portal_ids/3
portal_ids/4
portal_ids/5
portal_ids/6
portal_ids/mysql_non_continuous_increasing_non_zodb
portal_memcached/default_memcached_plugin
portal_preferences/default_site_preference
\ No newline at end of file
......@@ -27,6 +27,7 @@
#
##############################################################################
import cgi
import unittest
import os
import requests
......@@ -34,6 +35,7 @@ from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from subprocess import Popen, PIPE
from AccessControl import getSecurityManager
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import addUserToDeveloperRole, findContentChain
......@@ -674,9 +676,20 @@ def makeTestMethod(validator, portal_type, view_name, bt_name):
self.portal,
portal_type)
document = createSubContent(module, portal_type_list)
view = getattr(document, view_name)
response = self.publish(
'%s/%s' % (document.getPath(), view_name),
user=str(getSecurityManager().getUser()),
handle_errors=False,
)
charset = 'iso8859-15'
content_type = response.getHeader('content-type')
if content_type:
_, params = cgi.parse_header(content_type)
charset = params.get('charset', charset)
self.assert_(*validate_xhtml( validator=validator,
source=view(),
source=response.getBody().decode(charset),
view_name=view_name,
bt_name=bt_name))
return testMethod
......@@ -742,6 +755,19 @@ if validator_to_use == 'tidy':
elif validator_to_use == 'nu':
validator = NuValidator(show_warnings)
expected_failure_list = (
# this view needs VCS preference set (this test suite does not support
# setting preferences, but this might be a way to fix this).
'test_erp5_forge_Business_Template_BusinessTemplate_viewVcsStatus',
# this view only works when solver decision has a relation to a solver.
# One way to fix this would be to allow a custom "init script" to be called
# on a portal type.
'test_erp5_simulation_Solver_Decision_SolverDecision_viewConfiguration',
# this view redirects to an external URL
'test_erp5_web_Static_Web_Site_WebSite_view',
)
def test_suite():
# add the tests
if validator is not None:
......@@ -749,15 +775,7 @@ def test_suite():
# on getBusinessTemplateList call
addTestMethodDynamically(TestXHTML, validator,
('erp5_core',) + TestXHTML.getBusinessTemplateList(),
expected_failure_list=(
# this view needs VCS preference set (this test suite does not support
# setting preferences, but this might be a way to fix this).
'test_erp5_forge_Business_Template_BusinessTemplate_viewVcsStatus',
# this view only works when solver decision has a relation to a solver.
# One way to fix this would be to allow a custom "init script" to be called
# on a portal type.
'test_erp5_simulation_Solver_Decision_SolverDecision_viewConfiguration',
))
expected_failure_list=expected_failure_list)
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestXHTML))
return suite
......@@ -114,15 +114,7 @@ def test_suite():
testclass,
testXHTML.validator,
tested_business_template_list,
expected_failure_list=(
# this view needs VCS preference set (this test suite does not support
# setting preferences, but this might be a way to fix this).
'test_erp5_forge_Business_Template_BusinessTemplate_viewVcsStatus',
# this view only works when solver decision has a relation to a solver.
# One way to fix this would be to allow a custom "init script" to be called
# on a portal type.
'test_erp5_simulation_Solver_Decision_SolverDecision_viewConfiguration',
),
expected_failure_list=testXHTML.expected_failure_list,
)
# required to create content in portal_components
......
Markdown is supported
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