1 """Test setup for unit, 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 zope.component import queryUtility
12
13 from Products.Five import zcml
14 from Products.Five import fiveconfigure
15
16 from Testing import ZopeTestCase as ztc
17
18 from Products.PloneTestCase import PloneTestCase as ptc
19 from Products.PloneTestCase.layer import onsetup
20
21 from platecom.ontoplone.interfaces.IThesaurus import IThesaurus
22 from platecom.ontocatalog.config import *
23 from pythesaurus.Concept import Concept
24
25 from platecom.langview.tests import utils
26
27
28
29
30
31
32
33
34
35
36
37
38
39 if not HAS_PLONE3:
40 ztc.installProduct('PloneLanguageTool')
41
42 ztc.installProduct('LinguaPlone')
43 ztc.installProduct('pluggablecatalog')
47 ztc.installProduct('Five')
48 fiveconfigure.debug_mode = True
49 zcml.load_config('configure.zcml', PACKAGE)
50 fiveconfigure.debug_mode = False
51
52
53
54 try:
55 from Products.Five import pythonproducts
56 pythonproducts.setupPythonProducts(None)
57
58
59
60 import App
61 App.ApplicationManager.ApplicationManager.Five=utils.Five
62
63
64
65
66
67
68
69 ztc.zopedoctest.functional.http=utils.http
70
71
72 except ImportError:
73
74 ztc.installPackage('icsemantic.core')
75 ztc.installPackage('icsemantic.langfallback')
76 ztc.installPackage('icsemantic.thesaurus')
77 ztc.installPackage(PROJECTNAME)
78 pass
79
80 setup_icsemantic.catalog()
81
82 ptc.setupPloneSite(products=[PROJECTNAME,])
85 """Fill the thesaurus local utility with some useful information"""
86 t = portal.utilities.IThesaurus
87 c = Concept(et = ["fútbol@es", "balón pie@es", "soccer@en", "football@en",
88 "football@fr"])
89 t.append_concept(c)
90 t.append_term("mundial@es", rt=["fútbol@es"])
91
94 """We use this base class for all the tests in this package. If necessary,
95 we can put common utility or setup code in here. This applies to unit
96 test cases.
97 """
99 super(ptc.PloneTestCase, self).setUp()
100
104 """We use this class for functional integration tests that use doctest
105 syntax. Again, we can put basic common utility or setup code in here.
106 """
110