Commit 5ef6fc26 authored by Julien Muchembled's avatar Julien Muchembled

Fix testCache & testProxify broken by [33519]

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33582 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ed75e826
......@@ -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
......@@ -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()
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