Package platecom :: Package langview :: Package tests :: Module base
[hide private]
[frames] | no frames]

Source Code for Module icsemantic.langfallback.tests.base

 1  """Test setup for integration and functional tests. 
 2   
 3  When we import PloneTestCase and then call setupPloneSite(), all of Plone's 
 4  products are loaded, and a Plone site will be created. This happens at module 
 5  level, which makes it faster to run each test, but slows down test runner 
 6  startup. 
 7  """ 
 8  import os, sys 
 9  from App import Common 
10   
11  from Products.Five import zcml 
12  from Products.Five import fiveconfigure 
13   
14  from Testing import ZopeTestCase as ztc 
15   
16  from Products.PloneTestCase import PloneTestCase as ptc 
17  from Products.PloneTestCase.layer import onsetup 
18   
19  from platecom.langview.config import * 
20   
21  import utils 
22   
23  # 
24  # When ZopeTestCase configures Zope, it will *not* auto-load products in 
25  # Products/. Instead, we have to use a statement such as: 
26  # 
27  #   ztc.installProduct('SimpleAttachment') 
28  # 
29  # This does *not* apply to products in eggs and Python packages (i.e. not in 
30  # the Products.*) namespace. For that, see below. 
31  # 
32  # All of Plone's products are already set up by PloneTestCase. 
33  # 
34   
35  ztc.installProduct('GenericSetup') 
36  ztc.installProduct('PloneLanguageTool') 
37  ztc.installProduct('LinguaPlone') 
38 39 @onsetup 40 -def setup_icsemantic.langfallback():
41 ztc.installProduct('Five') 42 fiveconfigure.debug_mode = True 43 zcml.load_config('configure.zcml', PACKAGE) 44 fiveconfigure.debug_mode = False 45 46 # MONKEYPATCH: everytime (until we figure out the problem where 47 # monkeypatch gets overwritten somewhere) 48 try: 49 from Products.Five import pythonproducts 50 pythonproducts.setupPythonProducts(None) 51 52 # MONKEYPATCH: arregla los problemas con el 53 # control panel y la instalacion de Five... 54 import App 55 App.ApplicationManager.ApplicationManager.Five=utils.Five 56 57 # MONKEYPATCH: arregla los problemas con el 58 # HTTP_REFERER en los tests funcionales. Tiene la 59 # contra de enviarnos al raiz del plone cada vez 60 # que un metodo depende de esa variable, pero es 61 # mejor que morir con una excepcion o llenar los 62 # tests de try blocks... 63 ztc.zopedoctest.functional.http=utils.http 64 except ImportError: 65 # Not needed in Plone 3 66 ztc.installPackage(PROJECTNAME)
67 68 setup_icsemantic.langfallback() 69 70 ptc.setupPloneSite(products=[PROJECTNAME,])
71 72 -class icSemanticTestCase(ptc.PloneTestCase):
73 """We use this base class for all the tests in this package. If necessary, 74 we can put common utility or setup code in here. This applies to unit 75 test cases. 76 """
77
78 -class icSemanticFunctionalTestCase(ptc.FunctionalTestCase):
79 """We use this class for functional integration tests that use doctest 80 syntax. Again, we can put basic common utility or setup code in here. 81 """
82 - def setUp(self):
83 # self.setRoles(['Manager',]) 84 # portal.invokeFactory('Folder', id='sb') 85 # self.sb = portal.sb 86 # self.sb_url = sb.absolute_url() 87 88 super(icSemanticFunctionalTestCase, self).setUp()
89