diff --git a/product/ERP5Form/tests/testProxify.py b/product/ERP5Form/tests/testProxify.py index 3a661b9fd8e6e1a2a64197f9b2941486bd1ec2ae..8b8dd1ff1285b43d5d59032edff5e77b10d00a45 100644 --- a/product/ERP5Form/tests/testProxify.py +++ b/product/ERP5Form/tests/testProxify.py @@ -26,40 +26,19 @@ # ############################################################################## -import unittest - -# Make it possible to use Globals.get_request -class DummyRequest(dict): - def set(self, k, v): - self[k] = v - -global request -request = DummyRequest() - -def get_request(): - global request - return request - -# apply patch (before it's imported by other modules) -from Products.ERP5Type import Globals -Globals.get_request = get_request - +from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.Formulator.TALESField import TALESMethod from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Form.Form import ERP5Form from Products.ERP5Form.ProxyField import purgeFieldValueCache -# install ERP5Form and load patches -from Testing import ZopeTestCase -ZopeTestCase.installProduct('ERP5Form') - -class TestProxify(unittest.TestCase): +class TestProxify(ERP5TypeTestCase): def getTitle(self): return "Proxify" - def setUp(self): + def afterSetUp(self): # base field library self.container = Folder('container').__of__(Folder('root')) self.container._setObject('Base_view', @@ -108,9 +87,6 @@ class TestProxify(unittest.TestCase): person_view.my_custom_description.values['editable'] = 0 person_view.my_another_description.values['editable'] = 0 - global request - request = DummyRequest() - def test_single_level_proxify(self): # StringField self.person_view.proxifyField({'my_name':'Base_view.my_string_field'}) @@ -235,9 +211,3 @@ class TestProxify(unittest.TestCase): self.assertEqual(field.meta_type, 'RelationStringField') self.assertEqual(field.get_value('title'), 'Organisation') self.assertEqual(field.get_value('proxy_listbox_ids'), [('OrganisationModule_viewOrganisationList/listbox', 'Organisation')]) - - -def test_suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestProxify)) - return suite diff --git a/product/ERP5Type/tests/testCache.py b/product/ERP5Type/tests/testCache.py index 20952c2ee23d98fdb8801897eefb5931b6bb1fb1..1ff45fc9ad42f06a3454892969a0a5a23182e62a 100644 --- a/product/ERP5Type/tests/testCache.py +++ b/product/ERP5Type/tests/testCache.py @@ -32,6 +32,7 @@ import unittest import time import os +from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.CachePlugins.RamCache import RamCache from Products.ERP5Type.CachePlugins.DistributedRamCache import\ DistributedRamCache @@ -42,13 +43,13 @@ from Products.ERP5Type.Tool.CacheTool import CacheTool class Foo: my_field = (1,2,3,4,5) -class TestRamCache(unittest.TestCase): +class TestRamCache(ERP5TypeTestCase): quiet = 1 def getTitle(self): return "Cache" - def setUp(self): + def afterSetUp(self): self.cache_plugins = (RamCache(), DistributedRamCache({'server': '127.0.0.1:11211', 'debug_level': 7, @@ -198,6 +199,3 @@ class TestRamCache(unittest.TestCase): values.append(my_text) values.append(Foo()) return values - -if __name__ == '__main__': - unittest.main()