test.erp5.testSlapOSConfigurator.py 10.6 KB
Newer Older
1 2 3 4 5 6 7
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################

8 9
from erp5.component.test.SlapOSTestCaseMixin import \
  SlapOSTestCaseMixin
10 11
import os

12
class TestSlapOSConfigurator(SlapOSTestCaseMixin):
13

14
  def bootstrapSite(self):
15
    SlapOSTestCaseMixin.bootstrapSite(self)
16 17 18
    self.getBusinessConfiguration().BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList()
    self.tic()

19
  def testConfiguredModuleGeneratorIDViaConstraint(self):
20
    """ Make sure Generator ID is well configured, in this
21
        case we trust on promise outcome."""
22
    self.assertEquals(self.portal.portal_ids.checkConsistency(), [])
23

24 25 26 27 28 29 30
    self.portal.person_module.setIdGenerator("_Id_fake")
    self.assertNotEquals(self.portal.portal_ids.checkConsistency(), [])
    self.portal.portal_ids.fixConsistency()
    self.assertEquals(self.portal.portal_ids.checkConsistency(), [])
    self.assertEquals(self.portal.person_module.getIdGenerator(),
                        "_generatePerDayId")

31 32 33
  def testConfiguredShacacheWebSite(self):
    """ Make sure Shacache WebSite is setuped by Alarm
        case we trust on promise outcome."""
34
    self.assertEquals(self.portal.web_site_module.checkConsistency(), [])
35

36 37 38 39
  def testConfiguredCacheViaConstraint(self):
    """ Make sure Volitile and Persistent Cache was configured well,
        invoking the consistency to check """
    self.assertEquals(self.portal.portal_memcached.checkConsistency(), [])
40

41
  def testConfiguredConversionServerViaConstraint(self):
42
    """ Make sure Conversion Server was configured well,
43 44
        invoking checkConsistency """
    self.assertEquals(self.portal.portal_preferences.checkConsistency(), [])
45

46
  def testConfiguredCertificateAuthoringConstraint(self):
47
    """Make sure Certificate Authoring was configured well,
48
       invoking checkConsistency.
49

50 51 52 53
       Make sure PAS is well configured."""
    self.assertEquals(self.portal.portal_certificate_authority.checkConsistency(), [])

  def testConfiguredTemplateToolViaConstraint(self):
54
    """ Make sure Template Tool Repositories was configured well,
55 56 57 58 59
        invoking checkConsistency """
    self.assertEquals(
        [ i for i in self.portal.portal_templates.checkConsistency()
                     if "(reinstall)" not in i.message], [])

60 61

  def testConfiguredVolatileCache(self):
62
    """  Make sure Memcached is configured
63
    """
64 65 66 67 68
    if self.isLiveTest():
      # This test is redundant with testConfiguredVolatileCacheViaPromise
      # and it is only aims to verify if test environment is behaving as
      # expected, nothing else, and if alamrs were invoked.
      return
69 70 71 72 73
    from Products.ERP5Type.tests.ERP5TypeTestCase import \
                                         _getVolatileMemcachedServerDict

    memcached_tool = self.getPortal().portal_memcached
    connection_dict = _getVolatileMemcachedServerDict()
74
    url_string = 'erp5-memcached-volatile:%(port)s' % connection_dict
75 76 77 78
    self.assertEquals(memcached_tool.default_memcached_plugin.getUrlString(),
                      url_string)

  def testConfiguredPersistentCache(self):
79
    """ Make sure Kumofs is configured
80
    """
81 82 83 84 85 86
    if self.isLiveTest():
      # This test is redundant with testConfiguredVolatileCacheViaPromise
      # and it is only aims to verify if test environment is behaving as
      # expected, nothing else, and if alamrs were invoked.
      return

87 88 89 90
    from Products.ERP5Type.tests.ERP5TypeTestCase import\
            _getPersistentMemcachedServerDict
    memcached_tool = self.getPortal().portal_memcached
    connection_dict = _getPersistentMemcachedServerDict()
91
    url_string = 'erp5-memcached-persistent:%(port)s' % connection_dict
92 93
    self.assertEquals(memcached_tool.persistent_memcached_plugin.getUrlString(),
                      url_string)
94

95
  def testConfiguredConversionServer(self):
96
    """ Make sure Conversion Server (Cloudooo) is
97 98
        well configured """
    if self.isLiveTest():
99
      # This test is redundant with testConfiguredConversionServerViaConstraint
100 101 102 103
      # and it is only aims to verify if test environment is behaving as
      # expected, nothing else, and if alamrs were invoked.
      return

104
    from Products.ERP5Type.tests.ERP5TypeTestCase import\
105
           _getConversionServerUrl
106 107
    # set preference
    preference_tool = self.portal.portal_preferences
108 109
    conversion_url = _getConversionServerUrl()
    self.assertEquals(preference_tool.getPreferredDocumentConversionServerUrl(), conversion_url)
110 111

  def testConfiguredCertificateAuthoring(self):
112 113 114 115 116 117 118 119 120
    """ Make sure Certificate Authoting is
        well configured. """

    if self.isLiveTest():
      # This test is redundant with testConfiguredVolatileCacheViaPromise
      # and it is only aims to verify if test environment is behaving as
      # expected, nothing else, and if alamrs were invoked.
      return

121 122 123 124
    self.assertTrue(self.portal.hasObject('portal_certificate_authority'))
    self.assertEquals(os.environ['TEST_CA_PATH'],
          self.portal.portal_certificate_authority.certificate_authority_path)

125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
  def testModuleHasIdGeneratorByDay(self):
    """ Ensure the Constraint sets appropriate id generator on all modules.
    """
    module_list = [module.getId() for module in self.portal.objectValues() 
                     if getattr(module, "getIdGenerator", None) is not None and \
                                        module.getIdGenerator() == "_generatePerDayId"]
    self.assertSameSet(module_list,
                [
       'access_token_module',
       'account_module',
       'accounting_module',
       'bug_module',
       'business_configuration_module',
       'business_process_module',
       'campaign_module',
       'component_module',
       'computer_model_module',
       'computer_module',
       'computer_network_module',
       'consumption_document_module',
       'credential_recovery_module',
       'credential_request_module',
       'credential_update_module',
       'currency_module',
       'cloud_contract_module',
       'data_set_module',
       'delivery_node_module',
       'document_ingestion_module',
       'document_module',
       'event_module',
       'external_source_module',
       'glossary_module',
       'hosting_subscription_module',
       'image_module',
       'implicit_item_movement_module',
       'internal_order_module',
       'internal_packing_list_module',
       'internal_supply_module',
       'internal_trade_condition_module',
       'inventory_module',
       'item_module',
       'knowledge_pad_module',
       'meeting_module',
       'notification_message_module',
       'open_internal_order_module',
       'open_purchase_order_module',
       'open_sale_order_module',
       'organisation_module',
       'person_module',
       'portal_activities',
       'portal_simulation',
       'product_module',
       'project_module',
       'purchase_order_module',
       'purchase_packing_list_module',
       'purchase_supply_module',
       'purchase_trade_condition_module',
       'quantity_unit_conversion_module',
       'query_module',
       'regularisation_request_module',
       'requirement_module',
       'returned_purchase_order_module',
       'returned_purchase_packing_list_module',
       'returned_sale_order_module',
       'returned_sale_packing_list_module',
       'sale_opportunity_module',
       'sale_order_module',
       'sale_packing_list_module',
       'sale_supply_module',
       'sale_trade_condition_module',
       'service_module',
       'service_report_module',
       'software_installation_module',
       'software_instance_module',
       'software_licence_module',
       'software_product_module',
       'software_publication_module',
       'software_release_module',
       'support_request_module',
       'system_event_module',
       'task_module',
       'task_report_module',
       'transformation_module',
       'trial_request_module',
       'upgrade_decision_module',
       'web_page_module',
       'web_site_module',
       'workflow_module',
     ])


216
  def testConfiguredBusinessTemplateList(self):
217 218 219
    """ Make sure Installed business Templates are
        what it is expected.  """

220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
    expected_business_template_list = [
      'erp5_core',
      'erp5_xhtml_style',
      'erp5_property_sheets',
      'erp5_mysql_innodb_catalog',
      'erp5_upgrader',
      'slapos_upgrader',
      'erp5_full_text_myisam_catalog',
      'erp5_core_proxy_field_legacy',
      'erp5_base',
      'erp5_administration',
      'erp5_workflow',
      'erp5_configurator',
      'slapos_configurator',
      'erp5_simulation',
      'erp5_pdm',
      'erp5_trade',
237
      'erp5_ui_test_core',
238 239 240 241 242 243 244 245 246 247 248 249 250
      'erp5_tiosafe_core',
      'erp5_item',
      'erp5_forge',
      'erp5_ingestion_mysql_innodb_catalog',
      'erp5_ingestion',
      'erp5_crm',
      'erp5_system_event',
      'erp5_secure_payment',
      'erp5_payzen_secure_payment',
      'erp5_ooo_import',
      'erp5_odt_style',
      'erp5_ods_style',
      'erp5_jquery',
251 252 253 254 255 256
      'erp5_jquery_plugin_colorpicker',
      'erp5_jquery_plugin_elastic',
      'erp5_jquery_plugin_jqchart',
      'erp5_jquery_plugin_mbmenu',
      'erp5_jquery_plugin_sheet',
      'erp5_jquery_sheet_editor',
257 258 259 260 261 262 263 264
      'erp5_jquery_ui',
      'erp5_dhtml_style',
      'erp5_knowledge_pad',
      'erp5_web',
      'erp5_rss_style',
      'erp5_dms',
      'erp5_content_translation',
      'erp5_software_pdm',
265
      'erp5_svg_editor',
266 267 268 269 270 271 272 273 274 275 276 277 278 279
      'erp5_computer_immobilisation',
      'erp5_open_trade',
      'erp5_accounting',
      'erp5_commerce',
      'erp5_credential',
      'erp5_km',
      'erp5_web_download_theme',
      'erp5_web_shacache',
      'erp5_data_set',
      'erp5_web_shadir',
      'erp5_invoicing',
      'erp5_simplified_invoicing',
      'erp5_credential_oauth2',
      'erp5_accounting_l10n_fr',
280 281 282 283 284 285 286 287 288 289
      'erp5_ace_editor',
      'erp5_code_mirror',
      'erp5_font',
      'erp5_hal_json_style',
      'erp5_l10n_fr',
      'erp5_l10n_zh',
      'erp5_movement_table_catalog',
      'erp5_web_renderjs_ui',
      'erp5_web_service',
      'slapos_ecoallocation',
290
      'slapos_jio',
291 292
      'slapos_l10n_zh',
      'slapos_trial_request',
293 294 295
      'erp5_bearer_token',
      'erp5_access_token',
      'erp5_project',
296 297 298
      'erp5_oauth',
      'erp5_oauth_facebook_login',
      'erp5_oauth_google_login',
299 300 301 302 303 304 305 306 307 308 309
      'slapos_cloud',
      'slapos_slap_tool',
      'slapos_category',
      'slapos_pdm',
      'slapos_crm',
      'slapos_accounting',
      'slapos_payzen',
      'slapos_web',
      'slapos_erp5',
    ]
    self.assertSameSet(expected_business_template_list,
310
      self.portal.portal_templates.getInstalledBusinessTemplateTitleList())