Commit bd8d83fb authored by Łukasz Nowak's avatar Łukasz Nowak

- update copyrights

 - remove not needed run and quiet parameters
 - clean not needed whitespaces
 - remove not needed imports


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28288 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d9bf057b
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2005-2009 Nexedi SA and Contributors. All Rights Reserved.
# Jerome Perrin <jerome@nexedi.com>
# Łukasz Nowak <luke@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
......@@ -33,17 +35,13 @@ from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from zExceptions import Unauthorized
from zLOG import LOG
from DateTime import DateTime
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Form.Document.Preference import Priority
class TestPreferences(ERP5TypeTestCase):
quiet = 1
run_all_tests = 1
def getTitle(self):
return "Portal Preference"
......@@ -61,7 +59,7 @@ class TestPreferences(ERP5TypeTestCase):
transaction.commit()
self.tic()
def createPreferences(self) :
def createPreferences(self):
""" create some preferences objects """
portal_preferences = self.getPreferenceTool()
## create initial preferences
......@@ -97,21 +95,14 @@ class TestPreferences(ERP5TypeTestCase):
"""
self.assertEquals('Preferences', self.getPreferenceTool().Title())
def test_AllowedContentTypes(self, quiet=quiet, run=run_all_tests):
def test_AllowedContentTypes(self):
"""Tests Preference can be added in Preference Tool.
"""
if not run: return
if not quiet:
ZopeTestCase._print('\n Test allowed content types')
self.failUnless('Preference' in [x.getId() for x in
self.getPortal().portal_preferences.allowedContentTypes()])
def test_EnablePreferences(self, quiet=quiet, run=run_all_tests) :
def test_EnablePreferences(self):
""" tests preference workflow """
if not run: return
if not quiet:
ZopeTestCase._print('\n Test enabling preferences')
portal_workflow = self.getWorkflowTool()
person1 = self.getPreferenceTool()['person1']
person2 = self.getPreferenceTool()['person2']
......@@ -141,12 +132,8 @@ class TestPreferences(ERP5TypeTestCase):
self.assertEquals(group.getPreferenceState(), 'enabled')
self.assertEquals(site.getPreferenceState(), 'global')
def test_GetPreference(self, quiet=quiet, run=run_all_tests):
def test_GetPreference(self):
""" checks that getPreference returns the good preferred value"""
if not run: return
if not quiet:
ZopeTestCase._print('\n Test getPreference')
portal_workflow = self.getWorkflowTool()
pref_tool = self.getPreferenceTool()
person1 = self.getPreferenceTool()['person1']
......@@ -212,13 +199,9 @@ class TestPreferences(ERP5TypeTestCase):
'this_does_not_exists', 'default'))
def test_GetAttr(self, quiet=quiet, run=run_all_tests) :
def test_GetAttr(self):
""" checks that preference methods can be called directly
on portal_preferences """
if not run: return
if not quiet:
ZopeTestCase._print('\n Test methods on portal_preference')
portal_workflow = self.getWorkflowTool()
pref_tool = self.getPreferenceTool()
person1 = self.getPreferenceTool()['person1']
......@@ -251,13 +234,9 @@ class TestPreferences(ERP5TypeTestCase):
except AttributeError :
pass
def test_SetPreference(self, quiet=quiet, run=run_all_tests) :
def test_SetPreference(self):
""" check setting a preference modifies
the first enabled user preference """
if not run: return
if not quiet:
ZopeTestCase._print('\n Test setting preferences')
portal_workflow = self.getWorkflowTool()
pref_tool = self.getPreferenceTool()
person1 = self.getPreferenceTool()['person1']
......@@ -276,13 +255,8 @@ class TestPreferences(ERP5TypeTestCase):
person1.getPreferredAccountingTransactionAtDate(),
DateTime(2004, 12, 31))
def test_UserIndependance(self, quiet=quiet, run=run_all_tests) :
def test_UserIndependance(self):
""" check that the preferences are related to the user. """
if not run: return
if not quiet:
ZopeTestCase._print(
'\n Test different users preferences are independants')
portal_workflow = self.getWorkflowTool()
portal_preferences = self.getPreferenceTool()
# create 2 users: user_a and user_b
......@@ -485,8 +459,6 @@ class TestPreferences(ERP5TypeTestCase):
except ImportError:
self.assertRaises(Unauthorized, user_pref.edit, preferred_ooodoc_server_address="localhost")
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPreferences))
......
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