Commit 2f187826 authored by Łukasz Nowak's avatar Łukasz Nowak

- update copyrights, add self to blame list

 - check that already available user preference is used
 - check that already available user preference is used in case of having system preference


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28210 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 339a2b36
# -*- coding: utf-8 -*-
#############################################################################
#
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2007-2009 Nexedi SA and Contributors. All Rights Reserved.
# TAHARA Yusei <yusei@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
......@@ -108,6 +110,55 @@ class TestTemplate(ERP5TypeTestCase):
self.assertEqual(new_document.getTitle(), 'My Foo 1')
def test_TemplateCreatePreferenceWithExistingUserPreference(self):
self.login(self.id())
user_preference = self.portal.portal_preferences.newContent(
portal_type='Preference')
user_preference.setPriority(Priority.USER)
user_preference.enable()
transaction.commit()
self.tic()
document = self.portal.foo_module.newContent(portal_type='Foo')
transaction.commit()
self.tic()
document.Base_makeTemplateFromDocument(form_id=None)
transaction.commit()
self.tic()
# created preference is reused to store template
self.assertEquals('enabled', user_preference.getPreferenceState())
self.assertEqual(len(user_preference.objectIds()), 1)
def test_TemplateCreatePreferenceWithSystemPreferenceEnabled(self):
ERP5TypeTestCase.login(self, 'ERP5TypeTestCase')
system_preference = self.portal.portal_preferences.newContent(
portal_type='System Preference')
system_preference.setPriority(Priority.SITE)
system_preference.enable()
transaction.commit()
self.tic()
self.login(self.id())
user_preference = self.portal.portal_preferences.newContent(
portal_type='Preference')
user_preference.setPriority(Priority.USER)
user_preference.enable()
transaction.commit()
self.tic()
document = self.portal.foo_module.newContent(portal_type='Foo')
transaction.commit()
self.tic()
document.Base_makeTemplateFromDocument(form_id=None)
transaction.commit()
self.tic()
# created preference is reused to store template
self.assertEquals('enabled', user_preference.getPreferenceState())
self.assertEqual(len(user_preference.objectIds()), 1)
def test_TemplateCreatePreference(self):
self.login('another user with no active preference')
active_user_preference_list = [p for p in
......
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