Commit a7019be3 authored by Gabriel Monnerat's avatar Gabriel Monnerat

Merge branch 'master' into slave_instance

parents 15de0159 3f32cfa9
...@@ -55,27 +55,6 @@ from AccessControl import getSecurityManager\n ...@@ -55,27 +55,6 @@ from AccessControl import getSecurityManager\n
from Products.ERP5Type.Log import log\n from Products.ERP5Type.Log import log\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
bt = portal.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sample")\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
for obj in portal.portal_catalog(path=["%%/%s" % i.replace("**", "%") for i in bt.getTemplatePathList()]):\n
obj.activate().updateLocalRolesOnSecurityGroups()\n
\n
for document in portal.portal_catalog(portal_type=bt.getTemplatePortalTypeRoleList()):\n
document.updateLocalRolesOnSecurityGroups()\n
\n
conversion_server_hostname = portal.portal_preferences.getPreferredOoodocServerAddress()\n
conversion_server_port = portal.portal_preferences.getPreferredOoodocServerPortNumber()\n
for preference_id in ["default_configurator_preference", "default_configurator_system_preference"]:\n
preference = getattr(portal.portal_preferences, preference_id)\n
if preference.getPortalType() == "System Preference":\n
preference.setPreferredOoodocServerPortNumber(conversion_server_port)\n
preference.setPreferredOoodocServerAddress(conversion_server_hostname)\n
\n
if isTransitionPossible(preference, "enable"):\n
preference.enable()\n
preference.updateLocalRolesOnSecurityGroups()\n
\n
for gadget in portal.portal_gadgets.objectValues():\n for gadget in portal.portal_gadgets.objectValues():\n
if gadget.getValidationState() == \'invisible\':\n if gadget.getValidationState() == \'invisible\':\n
gadget.visible()\n gadget.visible()\n
......
...@@ -95,10 +95,10 @@ bt5_installation_list = ( \n ...@@ -95,10 +95,10 @@ bt5_installation_list = ( \n
\'vifib_crm\', \n \'vifib_crm\', \n
\'vifib_forge_release\', \n \'vifib_forge_release\', \n
\'vifib_software_pdm\', \n \'vifib_software_pdm\', \n
\'vifib_web\', \n \'vifib_web\',\n
\'vifib_open_trade\', \n \'vifib_open_trade\', \n
\'vifib_l10n_fr\'\n \'vifib_l10n_fr\',\n
\'vifib_datas\'\n \'vifib_datas\',\n
\'vifib_erp5\'\n \'vifib_erp5\'\n
)\n )\n
\n \n
......
...@@ -29,42 +29,61 @@ from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \ ...@@ -29,42 +29,61 @@ from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \
TestLiveConfiguratorWorkflowMixin TestLiveConfiguratorWorkflowMixin
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): class TestVifibConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
""" """
Configurator Mixin Class Configurator Mixin Class
""" """
# The list of standard business templates that the configurator should force # The list of standard business templates that the configurator should force
# to install # to install
user_reference = "demo" user_reference = "demo"
standard_bt5_list = ('erp5_simulation', standard_bt5_list = (
'erp5_dhtml_style', 'erp5_simulation',
'erp5_jquery', 'erp5_administration',
'erp5_jquery_ui', 'erp5_pdm',
'erp5_xhtml_jquery_style', 'erp5_trade',
'erp5_ingestion_mysql_innodb_catalog', 'erp5_simulation_test',
'erp5_ingestion', 'erp5_item',
'erp5_web', 'erp5_open_trade',
'erp5_dms', 'erp5_forge',
'erp5_crm', 'erp5_ingestion_mysql_innodb_catalog',
'erp5_pdm', 'erp5_ingestion',
'erp5_trade', 'erp5_crm',
'erp5_knowledge_pad', 'erp5_jquery',
'erp5_accounting', 'erp5_jquery_ui',
'erp5_tax_resource', 'erp5_knowledge_pad',
'erp5_discount_resource', 'erp5_web',
'erp5_invoicing', 'erp5_dms',
'erp5_configurator_standard_categories', 'erp5_l10n_fr',
'erp5_trade_knowledge_pad', 'erp5_content_translation',
'erp5_crm_knowledge_pad', 'erp5_software_pdm',
'erp5_simulation_test', 'erp5_computer_immobilisation',
'erp5_simplified_invoicing', 'erp5_accounting',
'erp5_ods_style', 'erp5_accounting_l10n_fr',
'erp5_odt_style', 'erp5_tax_resource',
'erp5_ooo_import', 'erp5_discount_resource',
'erp5_accounting_l10n_fr', 'erp5_invoicing',
'erp5_l10n_fr', 'erp5_ods_style',
'erp5_l10n_pt-BR', 'erp5_odt_style',
'erp5_demo_maxma_rule') 'erp5_ooo_import',
'erp5_simplified_invoicing',
'erp5_legacy_tax_system',
'erp5_commerce',
'erp5_project',
'erp5_credential',
'erp5_km',
'erp5_web_download_theme',
'vifib_mysql_innodb_catalog',
'vifib_core',
'vifib_base',
'vifib_slap',
'vifib_crm',
'vifib_forge_release',
'vifib_software_pdm',
'vifib_web',
'vifib_open_trade',
'vifib_l10n_fr',
'vifib_datas',
'vifib_erp5')
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy', return ('erp5_core_proxy_field_legacy',
...@@ -72,7 +91,7 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): ...@@ -72,7 +91,7 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
'erp5_base', 'erp5_base',
'erp5_workflow', 'erp5_workflow',
'erp5_configurator', 'erp5_configurator',
'erp5_configurator_maxma_demo',) 'erp5_configurator_vifib',)
def stepCreateBusinessConfiguration(self, sequence=None,\ def stepCreateBusinessConfiguration(self, sequence=None,\
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -80,7 +99,7 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): ...@@ -80,7 +99,7 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
module = self.portal.business_configuration_module module = self.portal.business_configuration_module
business_configuration = module.newContent( business_configuration = module.newContent(
portal_type="Business Configuration", portal_type="Business Configuration",
title='Test Configurator Maxma Demo Workflow') title='Test Configurator Vifib Workflow')
next_dict = {} next_dict = {}
sequence.edit(business_configuration=business_configuration, sequence.edit(business_configuration=business_configuration,
next_dict=next_dict) next_dict=next_dict)
...@@ -94,44 +113,13 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): ...@@ -94,44 +113,13 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
self.assertEquals('show', response_dict['command']) self.assertEquals('show', response_dict['command'])
self.assertEquals('Install', response_dict['next']) self.assertEquals('Install', response_dict['next'])
def stepSetMaxmaDemoWorkflow(self, sequence=None, sequence_list=None, **kw): def stepSetVifibWorkflow(self, sequence=None, sequence_list=None, **kw):
""" Set Consulting Workflow into Business Configuration """ """ Set Consulting Workflow into Business Configuration """
business_configuration = sequence.get("business_configuration") business_configuration = sequence.get("business_configuration")
self.setBusinessConfigurationWorkflow(business_configuration, self.setBusinessConfigurationWorkflow(business_configuration,
"workflow_module/maxma_demo_configuration_workflow") "workflow_module/vifib_configuration_workflow")
def stepViewCreatedPersons(self, sequence=None, sequence_list=None, **kw):
self.login(user_name='test_configurator_user')
person_list = self.portal.person_module.searchFolder()
self.assertNotEquals(0, len(person_list))
for entity in person_list:
for username in self.all_username_list:
self.failUnlessUserCanAccessDocument(username, entity)
self.failUnlessUserCanViewDocument(username, entity)
def stepViewCreatedOrganisations(self, sequence=None, sequence_list=None, **kw):
self.login(user_name='test_configurator_user')
organisation_list = self.portal.organisation_module.searchFolder()
self.assertNotEquals(0, len(organisation_list))
for entity in organisation_list:
for username in self.all_username_list:
self.failUnlessUserCanAccessDocument(username, entity)
self.failUnlessUserCanViewDocument(username, entity)
def stepViewCreatedAssignemnts(self, sequence=None, sequence_list=None, **kw):
self.login(user_name='test_configurator_user')
person_list = self.portal_person_module.searchFolder()
self.assertNotEquals(0, len(person_list))
for person in person_list:
for assignment in person.contentValues(portal_type='Assignment'):
for username in self.all_username_list:
self.failUnlessUserCanAccessDocument(username, assignment)
self.failUnlessUserCanViewDocument(username, assignment)
def stepCheckMaxmaDemoSampleObjectList(self, sequence=None, sequence_list=None, **kw): def stepCheckMaxmaDemoSampleObjectList(self, sequence=None, sequence_list=None, **kw):
""" Check if objects are placed into the appropriate state """ """ Check if objects are placed into the appropriate state """
...@@ -143,22 +131,11 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): ...@@ -143,22 +131,11 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
gadget.getValidationState())) gadget.getValidationState()))
gadget.Base_checkConsistency() gadget.Base_checkConsistency()
# Check if demo user is working.
user = self.portal.portal_catalog.getResultValue(portal_type="Person",
reference=self.user_reference)
self.assertNotEquals(user.Person_getAvailableAssignmentValueList(), [])
self.assertEquals(user.getTitle(), "Jack Vale")
self.assertEquals(user.getValidationState(), "validated")
self.assertEquals(user.getSubordination(),
'organisation_module/myorganisation')
self.assertEquals(user.getSubordinationTitle(), "Maxma Co")
### STEPS ### STEPS
DEFAULT_SEQUENCE_LIST = """ DEFAULT_SEQUENCE_LIST = """
stepCreateBusinessConfiguration stepCreateBusinessConfiguration
stepTic stepTic
stepSetMaxmaDemoWorkflow stepSetVifibWorkflow
stepTic stepTic
stepConfiguratorNext stepConfiguratorNext
stepTic stepTic
...@@ -171,61 +148,9 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): ...@@ -171,61 +148,9 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
stepStartConfigurationInstallation stepStartConfigurationInstallation
stepTic stepTic
stepCheckInstanceIsConfigured%(country)s stepCheckInstanceIsConfigured%(country)s
stepCheckMaxmaDemoSampleObjectList
stepTic
stepViewAddGadget
stepViewEventModule
stepAddEvent
stepSentEventWorkflow
stepViewAccountModule
stepAddAccountModule
stepViewAccount
stepCopyPasteAccount
stepViewEntityModules
stepAddEntityModules
stepCopyAndPastePerson
stepCopyAndPasteOrganisation
stepEntityWorkflow
stepViewCreatedPersons
stepViewCreatedOrganisations
stepViewCreatedAssignemnts
stepAddAccoutingPeriod
stepValidatedAccountingPeriods
stepViewBankAccount
stepViewCreditCard
stepValidateAndModifyBankAccount
stepValidateAndModifyCreditCard
stepAddPaymentNodeInPerson
stepAddPaymentNodeInOrganisation
stepCopyAndPasteBankAccountInPerson
stepCopyAndPasteBankAccountInOrganisation
stepViewAccountingTransactionModule
stepAddAccountingTransactionModule
stepCopyAndPasteAccountingTransactions
stepTic
stepAccountingTransaction
stepTic
stepSaleInvoiceTransaction
stepTic
stepPurchaseInvoiceTransaction
stepTic
stepPaymentTransaction
stepTic
stepBalanceTransaction
stepTic
stepAccountingTransaction_getCausalityGroupedAccountingTransactionList
stepAddAssignments
stepAssignmentTI
stepEditAssignments
stepViewAcessAddPurchaseTradeCondition
stepViewAccessAddSaleTradeCondition
stepViewAccessAddSaleOrder
stepViewAccessAddSalePackingList
stepViewAccessPurchaseOrder
stepPurchasePackingList
""" """
def test_maxma_demo_workflow(self): def test_vifib_workflow(self):
""" Test the consulting workflow configuration""" """ Test the consulting workflow configuration"""
self.all_username_list = ["demo"] self.all_username_list = ["demo"]
self.accountant_username_list = self.all_username_list self.accountant_username_list = self.all_username_list
...@@ -241,5 +166,5 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): ...@@ -241,5 +166,5 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
import unittest import unittest
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestMaxmaDemoConfiguratorWorkflow)) suite.addTest(unittest.makeSuite(TestVifibConfiguratorWorkflow))
return suite return suite
8 11
\ No newline at end of file \ No newline at end of file
testMaxmaDemoConfigurationWorkflow testVifibConfigurationWorkflow
\ No newline at end of file \ No newline at end of file
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo, Unauthorized, getSecurityManager
from Products.ERP5.Document.Person import Person as ERP5Person from Products.ERP5.Document.Person import Person as ERP5Person
class Person(ERP5Person): class Person(ERP5Person):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declarePublic('getCertificate') security.declarePublic('getCertificate')
def _checkReference(self): def _checkCertificateRequest(self):
if not self.getReference(): try:
raise ValueError('No reference set.') self.checkUserCanChangePassword()
except Unauthorized:
# in ERP5 user has no SetOwnPassword permission on Person document
# referring himself, so implement "security" by checking that currently
# logged in user is trying to get/revoke his own certificate
reference = self.getReference()
if not reference:
raise
if getSecurityManager().getUser().getId() != reference:
raise
def _getCertificate(self): def _getCertificate(self):
return self.getPortalObject().portal_certificate_authority\ return self.getPortalObject().portal_certificate_authority\
...@@ -18,13 +28,11 @@ class Person(ERP5Person): ...@@ -18,13 +28,11 @@ class Person(ERP5Person):
def getCertificate(self): def getCertificate(self):
"""Returns new SSL certificate""" """Returns new SSL certificate"""
self._checkReference() self._checkCertificateRequest()
self.checkUserCanChangePassword()
return self._getCertificate() return self._getCertificate()
security.declarePublic('revokeCertificate') security.declarePublic('revokeCertificate')
def revokeCertificate(self): def revokeCertificate(self):
"""Revokes existing certificate""" """Revokes existing certificate"""
self._checkReference() self._checkCertificateRequest()
self.checkUserCanChangePassword()
self._revokeCertificate() self._revokeCertificate()
...@@ -51,13 +51,12 @@ class SoftwareInstance(Item): ...@@ -51,13 +51,12 @@ class SoftwareInstance(Item):
xml = self.getSlaXml() xml = self.getSlaXml()
if xml is not None and xml != '': if xml is not None and xml != '':
tree = etree.fromstring(xml.encode('utf-8')) tree = etree.fromstring(xml.encode('utf-8'))
for element in tree.iter(tag=etree.Element): for element in tree.findall('parameter'):
if element.tag == 'parameter': key = element.get('id')
key = element.get('id') value = result_dict.get(key, None)
value = result_dict.get(key, None) if value is not None:
if value is not None: value = value + ' ' + element.text
value = value + ' ' + element.text else:
else: value = element.text
value = element.text result_dict[key] = value
result_dict[key] = value
return result_dict return result_dict
...@@ -41,109 +41,46 @@ class TestVifibCredential(testVifibMixin): ...@@ -41,109 +41,46 @@ class TestVifibCredential(testVifibMixin):
result_list.append("vifib_credential") result_list.append("vifib_credential")
return result_list return result_list
def createCredentialRequest(self, def stepSetCredentialRequestAutomaticApprovalPreferences(self):
first_name="Gabriel", self.setSystemPreference()
last_name="Monnerat", default_system_preference = self.portal.portal_preferences.restrictedTraverse(self.getDefaultSitePreferenceId())
reference="gabriel", self.login("ERP5TypeTestCase")
password="123", default_system_preference.edit(preferred_credential_request_automatic_approval=True)
default_email_text="gabriel@test.com"): self.logout()
def stepValidateNotificationMessage(self):
module = self.portal.notification_message_module
reference = "crendential_request-confirmation-without-password"
search_result = module.searchFolder(reference=reference)
[notification.getObject().validate() for notification in search_result]
def testBase_getDefaultAssignmentArgumentDict(self):
self.stepValidateNotificationMessage()
self.stepSetCredentialRequestAutomaticApprovalPreferences()
self.logout() self.logout()
self.portal.ERP5Site_registerCredentialRequest(first_name=first_name, portal_catalog = self.portal.portal_catalog
last_name=last_name, self.portal.ERP5Site_registerCredentialRequest(first_name="Vifib",
reference=reference, last_name="Test",
password=password, reference="vifib_test",
password="vifib",
career_subordination_title="", career_subordination_title="",
default_email_text=default_email_text, default_email_text="vifib@vifib.com",
default_telephone_text="223344", default_telephone_text="223344",
default_address_street_address="Test Street", default_address_street_address="Test Street",
default_address_city="Campos", default_address_city="My Street",
default_address_zip_code="28024030") default_address_zip_code="28024030")
self.login("ERP5TypeTestCase") self.login("ERP5TypeTestCase")
self.stepTic() self.stepTic()
credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
def createSystemPreference(self): reference="vifib_test")
""" """
portal_preferences = self.getPreferenceTool()
preference = portal_preferences.newContent(portal_type='System Preference',
title='Default Site Preference',
id='test_site_preference')
self.stepTic()
return preference
def afterSetUp(self):
""" """
portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
if preference is None:
preference = self.createSystemPreference()
if preference.getPreferenceState() == 'disabled':
preference.enable()
preference.edit(preferred_credential_request_automatic_approval=True,
preferred_credential_recovery_automatic_approval=True,
preferred_organisation_credential_update_automatic_approval=True,
preferred_person_credential_update_automatic_approval=True)
self.portal.email_from_address = 'site@example.invalid'
oldMailHost = getattr(self.portal, 'MailHost', None)
if oldMailHost is not None:
self.portal.manage_delObjects(['MailHost'])
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
self.stepTic()
def testMailMessagePosted(self):
""" Test if the Mail Message was posted correctly """
self.createCredentialRequest(reference="vifibtest")
portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="vifibtest")
mail_message = portal_catalog.getResultValue(portal_type="Mail Message",
follow_up=credential_request)
self.assertEquals(mail_message.getSimulationState(), "started")
self.assertTrue("key=%s" % mail_message.getReference() in mail_message.getTextContent())
def test_MailFromMailMessageEvent(self):
""" """
self.createCredentialRequest(first_name="Vifib",
last_name="Test",
reference="vifibtest")
portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="vifibtest",
first_name="Vifib",
last_name="Test")
mail_message = portal_catalog.getResultValue(portal_type="Mail Message",
follow_up=credential_request)
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, message_text = last_message
self.assertEquals(mfrom, 'Portal Administrator <site@example.invalid>')
self.assertEquals(['Vifib Test <gabriel@test.com>'], mto)
self.assertNotEquals(re.search("Subject\:.*Welcome_to_Vifib", message_text), None)
self.assertNotEquals(re.search("Hello\ Vifib\ Test\,", message_text), None)
self.assertNotEquals(re.search("key\=..%s" % mail_message.getReference(), message_text), None)
def testERP5Site_activeLogin(self):
""" Test if the script WebSection_activeLogin will create one user
correctly """
self.createCredentialRequest()
portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="gabriel")
mail_message = portal_catalog.getResultValue(portal_type="Mail Message", mail_message = portal_catalog.getResultValue(portal_type="Mail Message",
follow_up=credential_request) follow_up=credential_request)
self.logout() self.logout()
self.portal.ERP5Site_activeLogin(mail_message.getReference()) self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.login("ERP5TypeTestCase") self.login("ERP5TypeTestCase")
self.stepTic() self.stepTic()
person = portal_catalog.getResultValue(reference="gabriel", portal_type="Person") person = portal_catalog.getResultValue(reference="vifib_test", portal_type="Person")
self.assertEquals(person.getValidationState(), "validated") assignment_list = person.objectValues(portal_type="Assignment")
assignment = assignment_list[0]
def testERP5Site_registerCredentialRequest(self): self.assertEquals(assignment.getFunction(), "customer")
""" Test if the script ERP5Site_registerCredentialRequest will create one self.assertEquals(assignment.getRole(), "client")
Credential Request correctly """
self.createCredentialRequest()
portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="gabriel")
self.assertEquals(credential_request.getFirstName(), "Gabriel")
self.assertEquals(credential_request.getDefaultEmailText(), "gabriel@test.com")
27 28
\ No newline at end of file \ No newline at end of file
...@@ -346,15 +346,14 @@ class SlapTool(BaseTool): ...@@ -346,15 +346,14 @@ class SlapTool(BaseTool):
result_dict = {} result_dict = {}
if xml is not None and xml != '': if xml is not None and xml != '':
tree = etree.fromstring(xml.encode('utf-8')) tree = etree.fromstring(xml.encode('utf-8'))
for element in tree.iter(tag=etree.Element): for element in tree.findall('parameter'):
if element.tag == 'parameter': key = element.get('id')
key = element.get('id') value = result_dict.get(key, None)
value = result_dict.get(key, None) if value is not None:
if value is not None: value = value + ' ' + element.text
value = value + ' ' + element.text else:
else: value = element.text
value = element.text result_dict[key] = value
result_dict[key] = value
return result_dict return result_dict
def _getModificationStatusForSlave(self, computer_partition_document): def _getModificationStatusForSlave(self, computer_partition_document):
......
...@@ -7036,43 +7036,82 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -7036,43 +7036,82 @@ class TestVifibSlapWebService(testVifibMixin):
# Person using PKI/Slap interface # Person using PKI/Slap interface
######################################## ########################################
def test_person_request_new_certificate(self): def _safe_revoke_certificate(self, person):
"""Chekcs that Person is capable to ask for new certificate""" from AccessControl import getSecurityManager
self.login() user = getSecurityManager().getUser().getId()
self.portal.portal_certificate_authority._checkCertificateAuthority()
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_user_admin')
try: try:
self.login('ERP5TypeTestCase')
person.revokeCertificate() person.revokeCertificate()
except ValueError, err: except ValueError, err:
if 'No certificate for' in err.message: if 'No certificate for' in err.message:
pass pass
else: else:
raise raise
finally:
self.login(user)
def test_person_request_new_certificate(self):
"""Checks that Person is capable to ask for new certificate"""
self.login()
self.portal.portal_certificate_authority._checkCertificateAuthority()
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_user_admin')
self._safe_revoke_certificate(person)
self.login('test_vifib_user_admin') self.login('test_vifib_user_admin')
transaction.commit()
certificate = person.getCertificate() certificate = person.getCertificate()
raise NotImplementedError self.assertTrue('CN=test_vifib_user_admin' in certificate['certificate'])
def test_person_request_revoke_certificate(self): def test_person_request_revoke_certificate(self):
"""Chekcs that Person is capable to ask for revocation of certificate""" """Chekcs that Person is capable to ask for revocation of certificate"""
raise NotImplementedError self.login()
self.portal.portal_certificate_authority._checkCertificateAuthority()
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_user_admin')
self._safe_revoke_certificate(person)
self.login('test_vifib_user_admin')
certificate = person.getCertificate()
self.assertTrue('CN=test_vifib_user_admin' in certificate['certificate'])
person.revokeCertificate()
def test_person_request_new_certificate_twice(self): def test_person_request_new_certificate_twice(self):
"""Checks that if Person asks twice for a certificate the next call """Checks that if Person asks twice for a certificate the next call
fails""" fails"""
raise NotImplementedError self.login()
self.portal.portal_certificate_authority._checkCertificateAuthority()
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_user_admin')
self._safe_revoke_certificate(person)
self.login('test_vifib_user_admin')
certificate = person.getCertificate()
self.assertTrue('CN=test_vifib_user_admin' in certificate['certificate'])
self.assertRaises(ValueError, person.getCertificate)
def test_person_request_certificate_for_another_person(self): def test_person_request_certificate_for_another_person(self):
"""Checks that if Person tries to request ceritifcate for someone else it """Checks that if Person tries to request ceritifcate for someone else it
will fail""" will fail"""
raise NotImplementedError from AccessControl import Unauthorized
self.login()
self.portal.portal_certificate_authority._checkCertificateAuthority()
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_user_admin')
self._safe_revoke_certificate(person)
self.login('test_hr_admin')
self.assertRaises(Unauthorized, person.getCertificate)
def test_person_request_revoke_certificate_for_another_person(self): def test_person_request_revoke_certificate_for_another_person(self):
"""Checks that if Person tries to request ceritifcate for someone else it """Checks that if Person tries to request ceritifcate for someone else it
will fail""" will fail"""
raise NotImplementedError from AccessControl import Unauthorized
self.login()
self.portal.portal_certificate_authority._checkCertificateAuthority()
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_user_admin')
self._safe_revoke_certificate(person)
self.login('test_vifib_user_admin')
certificate = person.getCertificate()
self.assertTrue('CN=test_vifib_user_admin' in certificate['certificate'])
self.login('test_hr_admin')
self.assertRaises(Unauthorized, person.revokeCertificate)
def stepPersonRequestSlapSoftwareInstanceNotFoundResponse(self, sequence, def stepPersonRequestSlapSoftwareInstanceNotFoundResponse(self, sequence,
**kw): **kw):
......
...@@ -33,7 +33,7 @@ setup(name=name, ...@@ -33,7 +33,7 @@ setup(name=name,
install_requires=[ install_requires=[
'Flask', # used by proxy 'Flask', # used by proxy
'lxml', # needed to play with XML trees 'lxml', # needed to play with XML trees
'netaddr', # to play safely with IPv6 prefixes 'netaddr>=0.7.5', # to play safely with IPv6 prefixes
'netifaces', # to fetch information about network devices 'netifaces', # to fetch information about network devices
'setuptools', # namespaces 'setuptools', # namespaces
'supervisor', # slapgrid uses supervisor to manage processes 'supervisor', # slapgrid uses supervisor to manage processes
......
...@@ -17,4 +17,5 @@ ipv4_local_network = 10.0.0.0/16 ...@@ -17,4 +17,5 @@ ipv4_local_network = 10.0.0.0/16
[slapproxy] [slapproxy]
host = 127.0.0.1 host = 127.0.0.1
port = 5000 port = 5000
database_uri = :memory: # or /path/to/file # You could also specify: /path/to/file
database_uri = :memory:
...@@ -164,16 +164,6 @@ class IComputerPartition(IBuildoutController): ...@@ -164,16 +164,6 @@ class IComputerPartition(IBuildoutController):
profile. profile.
""" """
def setInstanceParameterDict(partition_parameter_kw):
"""
Set instance parameter informations on the slagrid server.
partition_parameter_kw -- dictionary of parameters.
This method can be used to propagate connection informations (like
service's port).
"""
def setUsage(usage_log): def setUsage(usage_log):
""" """
Associate a usage log to the computer partition. Associate a usage log to the computer partition.
......
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