[Chandler-dev] Re: [commits] (bkirsch) [10798] Adds unicode and
i18n support to unit and functional tests run by do_tests script.
Dan Steinicke
dan at osafoundation.org
Wed May 31 11:29:19 PDT 2006
TestCrypto.py started failing on winXP after this commit. AFAIK no one
is trying to fix it.
Dan
commits at osafoundation.org wrote:
> Revision
> 10798 <http://viewcvs.osafoundation.org/chandler?view=rev&rev=10798>
> Author
> bkirsch
> Date
> 2006-05-30 17:34:12 -0700 (Tue, 30 May 2006)
>
>
> Log Message
>
> Adds unicode and i18n support to unit and functional tests run by
> do_tests script. This is first stage in internationalizing Chanlder
> testing. Additional work will be done to parse date, numbers, and
> currency in a localized manner. Fixes open task bug 5952
> <http://bugzilla.osafoundation.org/show_bug.cgi?id=5952>. r=grant r=markku
>
>
> Modified Paths
>
> * trunk/chandler/application/tests/TestCrypto.py
> <#trunkchandlerapplicationtestsTestCryptopy>
> * trunk/chandler/application/tests/TestParcelPerf.py
> <#trunkchandlerapplicationtestsTestParcelPerfpy>
> * trunk/chandler/application/tests/TestSchemaAPI.py
> <#trunkchandlerapplicationtestsTestSchemaAPIpy>
> * trunk/chandler/i18n/tests/__init__.py
> <#trunkchandleri18ntests__init__py>
> * trunk/chandler/parcels/osaf/framework/certstore/tests/TestSSL.py
> <#trunkchandlerparcelsosafframeworkcertstoretestsTestSSLpy>
> * trunk/chandler/parcels/osaf/framework/scripting/script.py
> <#trunkchandlerparcelsosafframeworkscriptingscriptpy>
> * trunk/chandler/parcels/osaf/mail/tests/TestI18nMessage.py
> <#trunkchandlerparcelsosafmailtestsTestI18nMessagepy>
> * trunk/chandler/parcels/osaf/pim/calendar/tests/TestFormatters.py
> <#trunkchandlerparcelsosafpimcalendartestsTestFormatterspy>
> * trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurrenceRuleSet.py
> <#trunkchandlerparcelsosafpimcalendartestsTestRecurrenceRuleSetpy>
> * trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py
> <#trunkchandlerparcelsosafpimcalendartestsTestRecurringEventpy>
> * trunk/chandler/parcels/osaf/pim/calendar/tests/TestReminders.py
> <#trunkchandlerparcelsosafpimcalendartestsTestReminderspy>
> * trunk/chandler/parcels/osaf/pim/calendar/tests/TestTimeZone.py
> <#trunkchandlerparcelsosafpimcalendartestsTestTimeZonepy>
> * trunk/chandler/parcels/osaf/pim/generate.py
> <#trunkchandlerparcelsosafpimgeneratepy>
> * trunk/chandler/parcels/osaf/pim/tests/TestCalendar.py
> <#trunkchandlerparcelsosafpimtestsTestCalendarpy>
> * trunk/chandler/parcels/osaf/pim/tests/TestCollections.py
> <#trunkchandlerparcelsosafpimtestsTestCollectionspy>
> * trunk/chandler/parcels/osaf/pim/tests/TestContacts.py
> <#trunkchandlerparcelsosafpimtestsTestContactspy>
> * trunk/chandler/parcels/osaf/pim/tests/TestContentModel.py
> <#trunkchandlerparcelsosafpimtestsTestContentModelpy>
> * trunk/chandler/parcels/osaf/pim/tests/TestLocations.py
> <#trunkchandlerparcelsosafpimtestsTestLocationspy>
> * trunk/chandler/parcels/osaf/pim/tests/TestMail.py
> <#trunkchandlerparcelsosafpimtestsTestMailpy>
> * trunk/chandler/parcels/osaf/pim/tests/TestNotes.py
> <#trunkchandlerparcelsosafpimtestsTestNotespy>
> * trunk/chandler/parcels/osaf/pim/tests/TestStampingTwice.py
> <#trunkchandlerparcelsosafpimtestsTestStampingTwicepy>
> * trunk/chandler/parcels/osaf/pim/tests/TestTask.py
> <#trunkchandlerparcelsosafpimtestsTestTaskpy>
> * trunk/chandler/parcels/osaf/sharing/Sharing.py
> <#trunkchandlerparcelsosafsharingSharingpy>
> * trunk/chandler/parcels/osaf/sharing/__init__.py
> <#trunkchandlerparcelsosafsharing__init__py>
> * trunk/chandler/parcels/osaf/sharing/tests/TestFileSystemSharing.py
> <#trunkchandlerparcelsosafsharingtestsTestFileSystemSharingpy>
> * trunk/chandler/parcels/osaf/sharing/tests/TestICalendar.py
> <#trunkchandlerparcelsosafsharingtestsTestICalendarpy>
> * trunk/chandler/parcels/osaf/sharing/tests/TestInMemoryConduit.py
> <#trunkchandlerparcelsosafsharingtestsTestInMemoryConduitpy>
> * trunk/chandler/parcels/osaf/sharing/tests/TestModifiableAttributes.py
> <#trunkchandlerparcelsosafsharingtestsTestModifiableAttributespy>
> * trunk/chandler/parcels/osaf/sharing/tests/TestViewMerging.py
> <#trunkchandlerparcelsosafsharingtestsTestViewMergingpy>
> * trunk/chandler/tools/QALogger.py <#trunkchandlertoolsQALoggerpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestCalView.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestCalViewpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestCreateAccounts.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestCreateAccountspy>
> * trunk/chandler/tools/QATestScripts/Functional/TestDates.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestDatespy>
> * trunk/chandler/tools/QATestScripts/Functional/TestDeleteCollection.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestDeleteCollectionpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestEditModeOnEnter.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestEditModeOnEnterpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestEventStacking.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestEventStackingpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestFlickrpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestImportOverwrite.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestImportOverwritepy>
> * trunk/chandler/tools/QATestScripts/Functional/TestImporting.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestImportingpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestMoveToTrash.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestMoveToTrashpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewCollNoteStampMulti.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewCollNoteStampMultipy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewCollection.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewCollectionpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewEvent.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewEventpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewItem.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewItempy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewMail.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewMailpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewNote.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewNotepy>
> * trunk/chandler/tools/QATestScripts/Functional/TestNewTask.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestNewTaskpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestRecurringEvent.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestRecurringEventpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestRemoveFromTrashOnImport.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestRemoveFromTrashOnImportpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestSharing.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestSharingpy>
> * trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestSubscribepy>
> * trunk/chandler/tools/QATestScripts/Functional/TestTableSelection.py
> <#trunkchandlertoolsQATestScriptsFunctionalTestTableSelectionpy>
> * trunk/chandler/tools/QAUITestAppLib.py
> <#trunkchandlertoolsQAUITestAppLibpy>
>
>
> Removed Paths
>
> * trunk/chandler/i18n/systemutils.py <#trunkchandleri18nsystemutilspy>
> * trunk/chandler/i18n/wxutils.py <#trunkchandleri18nwxutilspy>
>
>
> Diff
>
>
> Modified: trunk/chandler/application/tests/TestCrypto.py
> (10797 => 10798)
>
>--- trunk/chandler/application/tests/TestCrypto.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/application/tests/TestCrypto.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import unittest, os, sys
>+from i18n.tests import uw
>
> from application import Utility
>
>@@ -8,22 +9,22 @@
> os.remove(os.path.join(self.path, 'randpool.dat'))
> except OSError:
> pass
>-
>+
> def setUp(self):
>- u = u"profileDir_(\u00FC)" # u umlaut
>+ u = uw("profileDir_")
> self.path = os.path.join(os.path.dirname(__file__),
> u.encode(sys.getfilesystemencoding()))
>-
>+
> try:
> os.makedirs(self.path)
> except OSError:
> pass
>-
>+
> self._removePool()
>
> def tearDown(self):
> self._removePool()
>-
>+
> try:
> os.rmdir(self.path)
> except OSError:
>@@ -35,11 +36,11 @@
> self.assert_(r == 0, r)
> r = Utility.stopCrypto(self.path)
> self.assert_(r == 0, r)
>-
>+
> # Trick us into thinking we have initialized entropy
> from osaf.framework.certstore import utils
> utils.entropyInitialized = True
>-
>+
> # Now we should save 1k on stop, after that loading and saving 1k
> r = Utility.initCrypto(self.path)
> self.assert_(r == 0, r)
>@@ -49,7 +50,7 @@
> self.assert_(r == 1024, r)
> r = Utility.stopCrypto(self.path)
> self.assert_(r == 1024, r)
>-
>
>+
> if __name__=='__main__':
> unittest.main()
>
>
> Modified: trunk/chandler/application/tests/TestParcelPerf.py
> (10797 => 10798)
>
>--- trunk/chandler/application/tests/TestParcelPerf.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/application/tests/TestParcelPerf.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -44,9 +44,9 @@
> view.commit()
> util.timing.end("application.tests.testParcelPerf.testCalendarEvents-commit")
> util.timing.results(verbose=False)
>-
>
>
>+
> def testLoadAllParcelItems(self):
> """ Load the entire content model into the repository and then commit it"""
> def load(parent):
>
>
> Modified: trunk/chandler/application/tests/TestSchemaAPI.py
> (10797 => 10798)
>
>--- trunk/chandler/application/tests/TestSchemaAPI.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/application/tests/TestSchemaAPI.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,5 +1,6 @@
> import unittest
> this_module = "application.tests.TestSchemaAPI" # change this if it moves
>+from i18n.tests import uw
>
> from application import schema, tests
> from repository.schema import Types
>@@ -96,8 +97,8 @@
>
> def testAnnotateKind(self):
> kind_kind = schema.itemFor(schema.Kind, self.rv)
>- CoreAnnotation(kind_kind).extraInfo = u"\u00FCFoo"
>- self.assertEqual(CoreAnnotation(kind_kind).extraInfo, u"\u00FCFoo")
>+ CoreAnnotation(kind_kind).extraInfo = uw("Foo")
>+ self.assertEqual(CoreAnnotation(kind_kind).extraInfo, uw("Foo"))
> parcel = schema.parcel_for_module(__name__, self.rv)
> CoreAnnotation(kind_kind).otherItem = parcel
> self.assertEqual(
>
>
> Deleted: trunk/chandler/i18n/systemutils.py (10797 => 10798)
>
>--- trunk/chandler/i18n/systemutils.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/i18n/systemutils.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1 +0,0 @@
>-"""Place holder for filesystem utilities"""
>
>
> Modified: trunk/chandler/i18n/tests/__init__.py (10797 => 10798)
>
>--- trunk/chandler/i18n/tests/__init__.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/i18n/tests/__init__.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -0,0 +1,75 @@
>+import random
>+
>+__all__ = ["AddUnicodeWrapper", "uw"]
>+
>+
>+# The unicode characters chosen at random as part of a
>+# getRandUnicodeChar method call
>+I18N_SEED = [
>+ u'\u00C5', #Nordic
>+ u'\u00FC', #German
>+ u'\u0414', #Cyrillic
>+ u'\u062B', #"Arabic"
>+ u'\u0E12', #Thai
>+ u'\u30C4', #Japanese
>+ u'\u0439',
>+ u'\u03b4',
>+ u'\u8fd1',
>+ u'\u85e4',
>+ u'\u6df3',
>+ u'\u4e5f',
>+ u'\u306e',
>+ u'\u65b0',
>+ u'\u30cd',
>+ u'\u30c3',
>+ u'\u30c8',
>+ u'\u30b3',
>+ u'\u30df',
>+ u'\u30e5',
>+ u'\u30cb',
>+ u'\u30c6',
>+ u'\u30a3',
>+ u'\u8ad6',
>+]
>+
>+I18N_SEED_SIZE = len(I18N_SEED)
>+
>+I18N_SEED_CACHE = {}
>+
>+def getRandUnicodeChar():
>+ return I18N_SEED[random.randrange(I18N_SEED_SIZE)]
>+
>+#XXX Not thread safe
>+def addUnicodeWrapper(defaultText):
>+ """
>+ This method is used for testing and adds unicode characters
>+ to the first and last positions in the defaultText string.
>+
>+ The unicode characters are chosen at random from an array of
>+ unicode characters. However, once a value is returned from
>+ addUnicodeWrapper it is cached. The addUnicodeWrapper method will always
>+ return the same wrapped value during a Python run. The values
>+ returned will differ however from run to run.
>+
>+ Since most tests use comparison as a means of validation, the caching
>+ mechanism ensures that the comparisons will be the same.
>+
>+ @type defaultText: unicode or ascii str
>+ @param defaultText: the text to wrap with unicode chars
>+
>+ @rtype: unicode
>+ @return: The original defaultText plus random unicode
>+ chars wrapping it.
>+ """
>+ if I18N_SEED_CACHE.has_key(defaultText):
>+ return I18N_SEED_CACHE[defaultText]
>+
>+ u = u"%s%s%s"% (getRandUnicodeChar(), defaultText, getRandUnicodeChar())
>+
>+ I18N_SEED_CACHE[defaultText] = u
>+ return u
>+
>+# Shortcut for calling addUnicodeWrapper. Used in the same manner as gettext and
>+# OSAF MessageFactories use the _(). instead of typing
>+# addUnicodeWrapper("text") one can use the short cut uw("text").
>+uw = addUnicodeWrapper
>
>
> Deleted: trunk/chandler/i18n/wxutils.py (10797 => 10798)
>
>--- trunk/chandler/i18n/wxutils.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/i18n/wxutils.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1 +0,0 @@
>-"""Place holder for wx utilities"""
>
>
> Modified:
> trunk/chandler/parcels/osaf/framework/certstore/tests/TestSSL.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/framework/certstore/tests/TestSSL.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/framework/certstore/tests/TestSSL.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -23,7 +23,7 @@
> super(TestSSL, self)._setup()
>
> self.profileDir = os.path.dirname(__file__)
>- Utility.initCrypto(self.profileDir)
>+ Utility.initCrypto(self.profileDir)
> self.testdir = self.profileDir
>
> super(TestSSL, self)._openRepository()
>@@ -34,7 +34,7 @@
> def tearDown(self):
> super(TestSSL, self).tearDown()
> Utility.stopCrypto(self.profileDir)
>-
>+
> def testCertificateVerification(self):
> ctx = ssl.getContext(self.rep.view)
> conn1 = SSL.Connection(ctx)
>@@ -60,10 +60,10 @@
> # XXX in a program.
> conn1.setblocking(1)
> #conn2.setblocking(1)
>-
>+
> if not self.isOnline():
> return
>-
>+
> # We wrap the connect() in try/except and filter some common
> # network errors that are not SSL-related.
> try:
>@@ -107,7 +107,7 @@
> QUW4hRYWNNbb
> -----END CERTIFICATE-----'''
> x509 = X509.load_cert_string(pemSite)
>-
>+
> factory = protocol.ClientFactory()
> wrapper = ssl.TwistedProtocolWrapper(self.rep.view,
> 'tlsv1',
>@@ -115,7 +115,7 @@
> policies.WrappingFactory(factory),
> 0,
> 1)
>-
>+
> self.assert_(wrapper.postConnectionVerify(x509, 'bugzilla.osafoundation.org'))
> self.assertRaises(Checker.WrongHost, wrapper.postConnectionVerify,
> x509, 'example.com')
>
>
> Modified:
> trunk/chandler/parcels/osaf/framework/scripting/script.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/framework/scripting/script.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/framework/scripting/script.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -140,7 +140,12 @@
> #Convert fileName with the system charset encoding
> #to bytes to prevent the join function from trying to downcast
> #the unicode fileName to ascii
>+
>+ if not isinstance(fileName, unicode):
>+ fileName = unicode(fileName, "utf8")
>+
> fileName = fileName.encode(sys.getfilesystemencoding())
>+
> #Convert the filePath bytes to unicode for storage
> filePath = unicode(os.path.join(os.path.dirname(siblingPath), fileName), sys.getfilesystemencoding())
> self.body = self.file_contents(filePath)
>@@ -161,6 +166,12 @@
> if profiler:
> profiler.stop() # start with the profile turned off
>
>+ if not isinstance(fileName, unicode):
>+ fileName = unicode(fileName, "utf8")
>+
>+ if not isinstance(scriptText, unicode):
>+ scriptText = unicode(scriptText, "utf8")
>+
> scriptText = scriptText.encode(sys.getfilesystemencoding())
> fileName = fileName.encode(sys.getfilesystemencoding())
>
>@@ -263,6 +274,10 @@
> Return the script from the file, given a file name
> and a path to a sibling file.
> """
>+
>+ if not isinstance(fileName, unicode):
>+ fileName = unicode(fileName, "utf8")
>+
> #Encode the unicode filename to the system character set encoding
> fileName = fileName.encode(sys.getfilesystemencoding())
>
>
>
> Modified:
> trunk/chandler/parcels/osaf/mail/tests/TestI18nMessage.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/mail/tests/TestI18nMessage.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/mail/tests/TestI18nMessage.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -26,22 +26,22 @@
> are decoded to Unicode, The Body is converted
> from bytes to Unicode, and that the headers and
> Body are properly encoded back to bytes.
>-
>+
> A header in a non-ascii charset
> should be encoded for sending. For example:
>-
>+
> To: =?utf-8?b?IsSFxI3EmcSXxK/FocWzxavFviDEhMSMxJjElsSuxaDFssWqxb0i?= <testreceive at test.com>
> """
>-
>- msgText = self.__loadTestMessage()
>-
>+
>+ msgText = self.__loadTestMessage()
>+
> #The message.messageObjectToKind method will
> #remove the headers from the c{email.Message} object
> #as they are encountered. Thus we want to keep a copy
> #of the original in mOne and pass mTmp to the
> #messageObjectToKind method
> mTmp = email.message_from_string(msgText)
>- mOne = email.message_from_string(msgText)
>+ mOne = email.message_from_string(msgText)
> messageKind = message.messageObjectToKind(self.rep.view, mTmp, msgText)
> mTwo = message.kindToMessageObject(messageKind)
>
>@@ -49,7 +49,7 @@
> self.assertEquals(mOne['From'], mTwo['From'])
> self.assertEquals(mOne['Subject'], mTwo['Subject'])
> self.assertEquals(mOne.get_payload(), mTwo.get_payload())
>-
>+
> def __loadTestMessage(self):
> rootdir = os.environ['CHANDLERHOME']
> testMessage = os.path.join(rootdir, 'parcels', 'osaf', 'mail',
>@@ -58,13 +58,13 @@
> fp = open(testMessage)
> messageText = fp.read()
> fp.close()
>-
>+
> return messageText
>-
>+
> def setUp(self):
> super(MessageI18nTest, self).setUp()
> self.loadParcel("osaf.pim.mail")
>-
>
>+
> if __name__ == "__main__":
> unittest.main()
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/calendar/tests/TestFormatters.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/calendar/tests/TestFormatters.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/calendar/tests/TestFormatters.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -13,39 +13,39 @@
> @ivar locale: Override to run your test class with a different
> locale.
> @type locale: PyICU.Locale
>-
>+
> @ivar tzinfo:
> @type tzinfo: PyICU.ICUtzinfo
> """
>-
>+
> locale = Locale.getUS()
> tzinfo = ICUtzinfo.getInstance("US/Pacific")
>
> def setUp(self):
> self.__savedLocale = Locale.getDefault()
> self.__savedTzinfo = ICUtzinfo.default
>-
>+
> Locale.setDefault(self.locale)
> TimeZone.setDefault(self.tzinfo.timezone)
>-
>+
> def tearDown(self):
> TimeZone.setDefault(self.__savedTzinfo.timezone)
> Locale.setDefault(self.__savedLocale)
>-
>
>
>+
> class ShortDateParse(AbstractTestCase):
>-
>+
> def testSimple(self):
> parsed = DateTimeUtil.shortDateFormat.parse("12/11/04")
>-
>+
> self.failUnlessEqual(parsed, datetime(2004,12,11))
>
> def testFullYear(self):
> parsed = DateTimeUtil.shortDateFormat.parse("3/7/2005")
>-
>+
> self.failUnlessEqual(parsed, datetime(2005,3,7))
>-
>+
> def testOutOfRangeYear(self):
> # Whoa, dude, that's a crazy year. But it triggers
> # bug 5650 on all platforms (e.g. 1904 works on
>@@ -59,7 +59,7 @@
> parsed = DateTimeUtil.shortDateFormat.parse(
> "12/11/04",
> datetime(2006, 1, 1,tzinfo=tzinfo))
>-
>+
> self.failUnlessEqual(parsed, datetime(2004,12,11, tzinfo=tzinfo))
>
> def testFullYearWithReference(self):
>@@ -67,9 +67,9 @@
> parsed = DateTimeUtil.shortDateFormat.parse(
> "3/7/2005",
> datetime(2002, 1, 9,tzinfo=tzinfo))
>-
>+
> self.failUnlessEqual(parsed, datetime(2005,3,7, tzinfo=tzinfo))
>-
>+
> def testOutOfRangeYearWithReference(self):
> tzinfo = ICUtzinfo.getInstance("Europe/Rome")
> parsed = DateTimeUtil.shortDateFormat.parse(
>@@ -80,18 +80,18 @@
>
>
> class ShortTimeParse(AbstractTestCase):
>-
>+
> def testPM(self):
> parsed = DateTimeUtil.shortTimeFormat.parse("12:03 PM")
>-
>+
> self.failUnlessEqual(parsed.timetz(), time(12, 3))
>
> def testAM(self):
> parsed = DateTimeUtil.shortTimeFormat.parse("12:52 AM")
>-
>+
> self.failUnlessEqual(parsed.timetz(), time(0, 52))
>
>-
>+
> """
> Tests to write:
>
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurrenceRuleSet.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurrenceRuleSet.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurrenceRuleSet.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -27,18 +27,18 @@
> tzinfo=ICUtzinfo.default),
> 'start' : self.start,
> 'count' : 20}
>-
>+
> self.monthly = {'end' : datetime(2005, 11, 4, 13,
> tzinfo=ICUtzinfo.default),
> 'start' : self.start,
> 'count' : 5}
>-
>+
> def _testRRule(self, freq, rrule):
> """Create a simple rrule, make sure it behaves as we expect."""
> self.assertEqual(rrule[0], getattr(self, freq)['start'])
> self.assertEqual(rrule[-1], getattr(self, freq)['end'])
> self.assertEqual(rrule.count(), getattr(self, freq)['count'])
>-
>+
> def _testCombined(self, rruleset):
> #not count1 + count2, because the two rules share self.start
> self.assertEqual(rruleset.count(), self.weekly['count'] +
>@@ -54,7 +54,7 @@
> else:
> ruleItem.freq = freq
> return ruleItem
>-
>+
> def _createBasicDateUtil(self, freq):
> return dateutil.rrule.rrule(toDateUtil(freq),
> count = getattr(self, freq)['count'],
>@@ -63,19 +63,19 @@
> def testDateUtilRRules(self):
> for freq in 'weekly', 'monthly':
> self._testRRule(freq, self._createBasicDateUtil(freq))
>-
>+
> def testFrequencyEnum(self):
> freqItem = FrequencyEnum()
> self.assert_('yearly' in freqItem.values)
> self.failIf('bicentenially' in freqItem.values)
>-
>+
> def testRuleItem(self):
> """Test that transformations of RecurrenceRules work."""
> ruleItem = self._createBasicItem('weekly')
> rrule = ruleItem.createDateUtilFromRule(self.weekly['start'])
> self._testRRule('weekly', rrule)
> self.rep.check()
>-
>+
> # Every other week in which Tuesday or Thursday falls on the 5th or 8th
> # of the month, for 4 occurrences. Yes, this is absurd :)
> complexRule = dateutil.rrule.rrule(WEEKLY, interval=2, count=4, wkst=SU,
>@@ -88,13 +88,13 @@
> # provide an RFC compliant mode, hopefully.
> self.assertNotEqual(complexRule[0], self.start)
> self.assertEqual(complexRule[-1], lastDate)
>-
>+
> ruleItem.setRuleFromDateUtil(complexRule)
>-
>+
> # make sure isCount was stored and until was set properly
> self.assert_(ruleItem.isCount)
> self.assertEqual(ruleItem.until, lastDate)
>-
>+
> # make sure byhour, byminute, and bysecond aren't set
> for ignored in ("byhour", "byminute", "bysecond"):
> self.assertEqual(getattr(ruleItem, ignored), None)
>@@ -102,7 +102,7 @@
> # make sure setRuleFromDateUtil(rrule).createDateUtilFromRule(dtstart)
> # represents the same dates as rrule
> identityTransformedRule = ruleItem.createDateUtilFromRule(self.start, False)
>-
>+
> # make sure the transform sets count, not until, since isCount==True
> self.assertEqual(identityTransformedRule._until, None)
> self.assertEqual(identityTransformedRule._count, 4)
>@@ -110,7 +110,7 @@
> # compare datetimes for original rule and identityTransformedRule
> self.assertEqual(list(identityTransformedRule),
> list(complexRule))
>-
>+
> def testInfiniteRuleItem(self):
> """Test that infinite RecurrenceRules work."""
> ruleItem = RecurrenceRule(None, itsView=self.rep.view)
>@@ -118,21 +118,21 @@
> rule = ruleItem.createDateUtilFromRule(self.start)
> self.assertEqual(rule[149],
> datetime(2008, 5, 12, 13, tzinfo=ICUtzinfo.default))
>-
>+
> def testTwoRuleSet(self):
> """Test two RecurrenceRules composed into a RuleSet."""
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleItem = self._createBasicItem('weekly')
> ruleSetItem.addRule(ruleItem)
> ruleSet = ruleSetItem.createDateUtilFromRule(self.start)
>-
>+
> #rrulesets support the rrule interface
> self._testRRule('weekly', ruleSet)
>-
>+
> ruleItem = self._createBasicItem('monthly')
> ruleSetItem.addRule(ruleItem)
> self._testCombined(ruleSetItem.createDateUtilFromRule(self.start))
>-
>+
> def testRuleSetFromDateUtil(self):
> ruleSet = dateutil.rrule.rruleset()
> for freq in 'weekly', 'monthly':
>@@ -140,11 +140,11 @@
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleSetItem.setRuleFromDateUtil(ruleSet)
> self._testCombined(ruleSetItem.createDateUtilFromRule(self.start))
>-
>+
> # test setting a rule instead of a ruleset
> ruleSetItem.setRuleFromDateUtil(self._createBasicDateUtil('weekly'))
> self._testRRule('weekly',ruleSetItem.createDateUtilFromRule(self.start))
>-
>+
> # test raising an exception when setting a non-rrule or rruleset
> self.assertRaises(TypeError, ruleSetItem.setRuleFromDateUtil, 0)
>
>@@ -156,9 +156,9 @@
> ruleSet.rdate(self.start + timedelta(days=2))
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleSetItem.setRuleFromDateUtil(ruleSet)
>-
>+
> self.assertEqual(ruleSetItem.rdates[0], self.start + timedelta(days=1))
>-
>+
> identityTransformed = ruleSetItem.createDateUtilFromRule(self.start)
> self.assertEqual(identityTransformed[2], self.start + timedelta(days=2))
> self.assertEqual(identityTransformed.count(), self.weekly['count'] +
>@@ -174,14 +174,14 @@
> ruleSetItem.setRuleFromDateUtil(ruleSet)
> identityTransformed = ruleSetItem.createDateUtilFromRule(self.start)
> self.assertNotEqual(self.start, identityTransformed[0])
>-
>+
> def testExRule(self):
> ruleSet = dateutil.rrule.rruleset()
> for freq in 'weekly', 'monthly':
> ruleSet.rrule(self._createBasicDateUtil(freq))
> exrule = dateutil.rrule.rrule(WEEKLY, count=10, dtstart=self.start)
> ruleSet.exrule(exrule)
>-
>+
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleSetItem.setRuleFromDateUtil(ruleSet)
> identityTransformed = ruleSetItem.createDateUtilFromRule(self.start)
>@@ -190,7 +190,7 @@
> self.assertEqual(identityTransformed.count(), self.weekly['count'] +
> self.monthly['count'] - 1
> - 10)
>-
>+
> def testNoAutoDateUtil(self):
> """dateutil sometimes sets bymonthday, byweekday, and bymonth based on
> dtstart, we want to avoid persisting this spurious data.
>@@ -203,7 +203,7 @@
> monthlyRule = dateutil.rrule.rrule(dateutil.rrule.MONTHLY)
> ruleItem.setRuleFromDateUtil(monthlyRule)
> self.failIf(ruleItem.hasLocalAttributeValue('bymonthday'))
>-
>+
> yearlyRule = dateutil.rrule.rrule(dateutil.rrule.YEARLY)
> ruleItem.setRuleFromDateUtil(yearlyRule)
> self.failIf(ruleItem.hasLocalAttributeValue('bymonthday'))
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -14,6 +14,7 @@
> from osaf.pim.tasks import TaskMixin
> from osaf.pim.calendar.Recurrence import RecurrenceRule, RecurrenceRuleSet
> from PyICU import ICUtzinfo
>+from i18n.tests import uw
>
> from application.dialogs.RecurrenceDialog import getProxy
> from itertools import chain
>@@ -33,7 +34,7 @@
> tzinfo=ICUtzinfo.default),
> 'start' : self.start,
> 'count' : 20}
>-
>+
> self.monthly = {'end' : datetime(2005, 11, 4, 13,
> tzinfo=ICUtzinfo.default),
> 'start' : self.start,
>@@ -45,7 +46,7 @@
> event.startTime = self.start
> event.endTime = event.startTime + timedelta(hours=1)
> event.anyTime = False
>- event.displayName = u"\u00FCSample event"
>+ event.displayName = uw("Sample event")
> return event
>
> def _createRuleSetItem(self, freq):
>@@ -60,55 +61,55 @@
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleSetItem.addRule(ruleItem)
> return ruleSetItem
>-
>+
> def testModificationEnum(self):
> self.assertEqual(self.event.modifies, None)
> self.modifies = "this"
>-
>+
> def testSimpleRuleBehavior(self):
> # self.event.occurrenceFor should default to self.event
> self.assertEqual(self.event.occurrenceFor, self.event)
> # getNextOccurrence for events without recurrence should be None
> self.assertEqual(self.event.getNextOccurrence(), None)
> self.failIf(self.event.isGenerated)
>-
>+
> self.event.rruleset = self._createRuleSetItem('weekly')
> self.assertEqual(self.event.isCustomRule(), False)
>-
>+
> secondStart = datetime(2005, 7, 11, 13, tzinfo=ICUtzinfo.default)
> second = self.event.getNextOccurrence()
> self.assert_(second.isGenerated)
> self.assertEqual(self.event.createDateUtilFromRule()[1], secondStart)
> self.assertEqual(second.startTime, secondStart)
> self.assertEqual(second.displayName, self.event.displayName)
>-
>+
> # make sure getNextOccurrence returns the same item when called twice
> self.assertEqual(second, self.event.getNextOccurrence())
>-
>+
> third = second.getNextOccurrence()
> thirdStart = datetime(2005, 7, 18, 13, tzinfo=ICUtzinfo.default)
> self.assertEqual(third.startTime, thirdStart)
>-
>+
> fourthStart = datetime(2005, 7, 25, 13, tzinfo=ICUtzinfo.default)
> fourth = self.event._createOccurrence(fourthStart)
> self.assert_(fourth.isGenerated)
> self.assertEqual(fourth, third.getNextOccurrence())
>-
>+
> # create a modification to be automatically deleted
>- fourth.displayName = u"\u00FCchanged title"
>-
>+ fourth.displayName = uw("changed title")
>+
> second.cleanRule()
> self.assertEqual(len(self.event.occurrences), 3)
>-
>+
> self.event.rruleset.rrules.first().until = thirdStart
>-
>+
> #changing the rule should delete our modified fourth
> self.assertEqual(len(self.event.occurrences), 2)
>-
>
>+
> def testFirstGeneratedOccurrence(self):
> """At least one generated occurrence must be created when rules are set.
>-
>+
> Because non-UI changes to recurring events should create THIS
> modifications to a master via onValueChanged, such modifications need to
> be created after the master's value has already changed. To make sure
>@@ -117,55 +118,55 @@
> except date and certain references) must be created each time a
> modification is made or a rule changes, so that, in effect, a backup
> of the master's data always exists.
>-
>+
> Note that it's possible for all of a rule's occurrences to be
> modifications, so occasionally no backup will exist
>-
>+
> """
> self.event.rruleset = self._createRuleSetItem('weekly')
>-
>+
> # setting the rule should trigger _getFirstGeneratedOccurrence
> self.assertEqual(len(self.event.occurrences), 2)
>-
>
>+
> def testThisModification(self):
>- self.event.displayName = u"\u00FCMaster Event" #no rruleset, so no modification
>+ self.event.displayName = uw("Master Event") #no rruleset, so no modification
> self.event.rruleset = self._createRuleSetItem('weekly')
> self.assertEqual(self.event.modifies, None)
>-
>+
> calmod = self.event.getNextOccurrence()
> self.assertEqual(self.event.modifications, None)
>-
>- calmod.changeThis('displayName', u'\u00FCModified occurrence')
>
>+ calmod.changeThis('displayName', uw('Modified occurrence'))
>+
> self.assertEqual(calmod.modificationFor, self.event)
> self.assertEqual(calmod.getFirstInRule(), self.event)
>-
>+
> self.assertEqual(list(self.event.modifications), [calmod])
>
> evtaskmod = calmod.getNextOccurrence()
>-
>+
> evtaskmod.StampKind('add', TaskMixin.getKind(self.rep.view))
>-
>+
> # changes to an event should, by default, create a THIS modification
> self.assertEqual(evtaskmod.modificationFor, self.event)
> self.assertEqual(evtaskmod.getFirstInRule(), self.event)
>
> for modOrMaster in [calmod, evtaskmod, self.event]:
> self.assertEqual(modOrMaster.getMaster(), self.event)
>-
>- self.event.displayName = u"\u00FCModification to master"
>+
>+ self.event.displayName = uw("Modification to master")
> self.assertNotEqual(None, self.event.occurrenceFor)
> self.assertNotEqual(self.event, self.event.occurrenceFor)
>-
>+
> # test getNextOccurrence ordering, bug 4083
> generated = evtaskmod.getNextOccurrence()
> self.assertEqual(self.event.getNextOccurrence(), calmod)
>-
>+
> evtaskmod.startTime = calmod.startTime - timedelta(hours=1)
> self.assertEqual(self.event.getNextOccurrence(), evtaskmod)
> self.assertEqual(calmod.getNextOccurrence(), generated)
>-
>+
> evtaskmod.startTime = generated.startTime + timedelta(hours=1)
> self.assertEqual(self.event.getNextOccurrence(), calmod)
> self.assertEqual(calmod.getNextOccurrence(), generated)
>@@ -180,7 +181,7 @@
> count = 3
> newRule = dateutil.rrule.rrule(dateutil.rrule.WEEKLY, count = count,
> interval = 3, dtstart = self.start)
>-
>+
> self.event.setRuleFromDateUtil(newRule)
> self.assertEqual(self.event.isCustomRule(), True)
>
>@@ -205,17 +206,17 @@
> self.assertEqual(list(occurs)[1].startTime,
> datetime(2005, 8, 15, 13, tzinfo=ICUtzinfo.default))
> self.rep.check()
>-
>+
> def testIcalUID(self):
> self.assertEqual(self.event.icalUID, unicode(self.event.itsUUID))
> self.event.rruleset = self._createRuleSetItem('weekly')
> self.assertEqual(self.event.icalUID,
> self.event.getNextOccurrence().icalUID)
>-
>+
> def testBug5483(self):
> """Check that an EXDATE of the first occurrence is correctly excluded."""
> self.start = self.event.startTime - timedelta(days=1)
>-
>+
> ruleItem = RecurrenceRule(None, itsView=self.rep.view)
> ruleItem.freq = 'daily'
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
>@@ -223,35 +224,35 @@
> self.event.rruleset = ruleSetItem
>
> self.event.rruleset.exdates = [self.event.startTime]
>-
>+
> oneWeek = self.start + timedelta(days=7, minutes=30)
>-
>+
> occurrences = self.event.getOccurrencesBetween(self.start, oneWeek)
>-
>+
> self.failIf(self.event in occurrences)
>
> def testRemoveRecurrence(self):
> self.event.rruleset = self._createRuleSetItem('weekly')
> self.event.removeRecurrence()
> self.assertEqual(len(self.event.occurrences), 1)
>-
>+
> self.event.rruleset = self._createRuleSetItem('weekly')
> second = self.event.getNextOccurrence()
> second.removeRecurrence()
> self.assertEqual(len(self.event.occurrences), 1)
>-
>+
> self.event.rruleset = self._createRuleSetItem('weekly')
> third = self.event.getNextOccurrence().getNextOccurrence()
> third.changeThisAndFuture('startTime', third.startTime + timedelta(hours=1))
> second = self.event.getNextOccurrence()
>-
>+
> rule = third.rruleset.rrules.first()
>-
>+
> third.removeRecurrence()
> self.assertEqual(len(third.occurrences), 1)
> self.failIf(second.isDeleted())
> self.assert_(rule.isDeleted())
>-
>+
> # test a THIS modification to master, then removing recurrence
> self.event.rruleset = self._createRuleSetItem('weekly')
> self.event.startTime += timedelta(hours=1)
>@@ -268,10 +269,10 @@
> self.event.rruleset = self._createRuleSetItem('weekly')
> self.event.removeRecurrence()
>
>-
>+
> def testProxy(self):
> self.failIf(self.event.isProxy())
>-
>+
> proxy = getProxy('test', self.event)
> proxy.dialogUp = True # don't try to create a dialog in a test
> self.assert_(proxy.isProxy())
>@@ -283,7 +284,7 @@
> self.assert_(self.event in proxy.rruleset.events)
> self.assertEqual(proxy.getNextOccurrence().occurrenceFor, self.event)
> self.assertEqual(len(list(proxy._generateRule())), self.weekly['count'])
>-
>+
> proxy.startTime = self.start + timedelta(days=1)
> self.assertEqual(self.event.startTime, self.start)
> self.assertEqual(proxy.startTime, self.start + timedelta(days=1))
>@@ -296,27 +297,27 @@
> second = self.event.getNextOccurrence()
>
> #one simple THISANDFUTURE modification
>- second.changeThisAndFuture('displayName', u'\u00FCModified title')
>-
>+ second.changeThisAndFuture('displayName', uw('Modified title'))
>+
> self.assertEqual(second.modificationFor, None)
>-
>+
> self.assert_(list(self.event.rruleset.rrules)[0].until < second.startTime)
>- self.assertEqual(second.displayName, u'\u00FCModified title')
>+ self.assertEqual(second.displayName, uw('Modified title'))
> self.assertEqual(list(second.rruleset.rrules)[0].freq, 'weekly')
> self.assertEqual(second.startTime, second.recurrenceID)
> self.assertEqual(second.icalUID, unicode(second.itsUUID))
> self.assertEqual(second.getLastUntil(), lastUntil)
>-
>+
> # make sure a backup occurrence is created
> self.assertEqual(len(list(second.occurrences)), 2)
> third = second.getNextOccurrence()
>- self.assertEqual(third.displayName, u'\u00FCModified title')
>+ self.assertEqual(third.displayName, uw('Modified title'))
>
> # create a changed fourth event to make sure its recurrenceID gets moved
> # when third's startTime is changed
> fourth = third.getNextOccurrence()
>- fourth.changeThis('displayName', u'\u00FCfourth')
>-
>+ fourth.changeThis('displayName', uw('fourth'))
>+
> thirdStart = third.startTime
> thirdChangedStart = thirdStart + timedelta(hours=1)
> third.changeThisAndFuture('startTime', thirdChangedStart)
>@@ -329,39 +330,39 @@
> self.assertEqual(third.rruleset, fourth.rruleset)
> self.assertEqual(third.icalUID, fourth.icalUID)
> self.assertNotEqual(second.icalUID, third.icalUID)
>-
>+
> # make sure second's rruleset was updated
> self.assert_(list(second.rruleset.rrules)[0].until < thirdChangedStart)
>-
>+
> # changing second's displayName again shouldn't create a new occurrence,
> # and third should be completely unchanged
>- second.changeThisAndFuture('displayName', u'\u00FCTwice modified title')
>+ second.changeThisAndFuture('displayName', uw('Twice modified title'))
>
> self.assertEqual(len(list(second.occurrences)), 1)
> self.assertEqual(third.startTime, thirdChangedStart)
>- self.assertEqual(third.displayName, u'\u00FCModified title')
>+ self.assertEqual(third.displayName, uw('Modified title'))
> self.assertEqual(third.getLastUntil(), lastUntil)
>-
>+
> # change second's rule
> second.changeThisAndFuture('rruleset',
> third.rruleset.copy(cloudAlias='copying'))
> newthird = second.getNextOccurrence()
>-
>+
> self.assertNotEqual(third, newthird)
> self.failIf(newthird.startTime == thirdChangedStart)
> self.assertEqual(list(second.rruleset.rrules)[0].until, lastUntil)
>-
>+
> # make a THIS change to a THISANDFUTURE modification
>- second.changeThis('displayName', u"\u00FCTHIS modified title")
>-
>+ second.changeThis('displayName', uw("THIS modified title"))
>+
> secondModified = second
> second = second.occurrenceFor
>
> self.assertEqual(second.occurrenceFor, None)
> self.assertNotEqual(secondModified.displayName, second.displayName)
> self.assertEqual(second.getNextOccurrence(), newthird)
>- self.assertEqual(newthird.displayName, u'\u00FCTwice modified title')
>-
>+ self.assertEqual(newthird.displayName, uw('Twice modified title'))
>+
> # make a THISANDFUTURE change to the THIS modification
> # FIXME: time changes need to preserve modifications for 0.6
> secondModified.changeThisAndFuture('duration', timedelta(hours=2))
>@@ -373,41 +374,41 @@
> # FIXME: these should work after time change preservation is implemented
> #self.assertEqual(second.displayName, u'Twice modified title')
> #self.assertEqual(third.displayName, u'Twice modified title')
>-
>
>+
> # check if modificationRecurrenceID works for changeThis mod
> second.startTime = datetime(2005, 7, 12, 13,
> tzinfo=ICUtzinfo.default) #implicit THIS mod
> self.assertEqual(second.getNextOccurrence().startTime,
> datetime(2005, 7, 18, 13, tzinfo=ICUtzinfo.default))
>-
>- third.lastModified = u'\u00FCChanged lastModified.'
>+
>+ third.lastModified = uw('Changed lastModified.')
> fourth = third.getNextOccurrence()
> fourth.startTime += timedelta(hours=4)
>-
>+
> # propagating thisandfuture modification to this
>- third.changeThisAndFuture('displayName', u'\u00FCYet another title')
>+ third.changeThisAndFuture('displayName', uw('Yet another title'))
> thirdModified = third
> third = third.occurrenceFor
> # Because fourth is a modification, its title should NOT have changed
>- self.assertEqual(fourth.displayName, u'\u00FCTwice modified title')
>-
>+ self.assertEqual(fourth.displayName, uw('Twice modified title'))
>+
> self.assertNotEqual(thirdModified.icalUID, second.icalUID)
> self.assertEqual(thirdModified.icalUID, third.icalUID)
> self.assertEqual(third.icalUID, fourth.icalUID)
> self.assertEqual(third.rruleset, fourth.rruleset)
>-
>- self.assertEqual(third.displayName, u'\u00FCYet another title')
>+
>+ self.assertEqual(third.displayName, uw('Yet another title'))
> self.failIf(third.hasLocalAttributeValue('lastModified'))
>- self.assertEqual(thirdModified.lastModified, u'\u00FCChanged lastModified.')
>+ self.assertEqual(thirdModified.lastModified, uw('Changed lastModified.'))
>
> self.assertEqual(fourth.modificationFor, third)
>-
>+
> #check propagation if first in rule is overridden with a THIS mod
>- thirdModified.changeThisAndFuture('displayName', u'\u00FCChanged again')
>+ thirdModified.changeThisAndFuture('displayName', uw('Changed again'))
>
>- self.assertEqual(third.displayName, u'\u00FCChanged again')
>- self.assertEqual(thirdModified.displayName, u'\u00FCChanged again')
>+ self.assertEqual(third.displayName, uw('Changed again'))
>+ self.assertEqual(thirdModified.displayName, uw('Changed again'))
>
> # THIS mod to master with no occurrences because of later modifications
> # doesn't create a mod
>@@ -416,7 +417,7 @@
> self.assertEqual(self.event.modificationRecurrenceID,
> self.event.startTime)
> self.assertEqual(self.event.startTime, self.event.recurrenceID)
>-
>+
> # change master event back to the original rule
> oldrule = self.event.rruleset
> self.event.changeThisAndFuture('rruleset',
>@@ -424,29 +425,29 @@
>
> self.assert_(oldrule.isDeleted)
> self.assertEqual(self.event.startTime, self.event.recurrenceID)
>-
>+
> # make sure changing master also changes master's recurrenceID
> self.event.changeThisAndFuture('startTime', self.start + timedelta(hours=3))
> self.assertEqual(self.event.startTime, self.event.recurrenceID)
> self.assertEqual(self.event.getLastUntil(), lastUntil)
>-
>+
> #make a THIS modification
> self.event.startTime -= timedelta(hours=3)
> eventModified = self.event
> self.event = self.event.occurrenceFor
> self.assertEqual(self.event.occurrenceFor, None)
> self.assertEqual(eventModified.startTime, self.start)
>-
>+
> self.assertEqual(self.event.startTime, self.start + timedelta(hours=6))
>-
>+
> # Test moving a later THIS modification when changing an earlier mod
>-
>+
> second = self.event.getNextOccurrence()
>- second.displayName = u"\u00FCsecond"
>+ second.displayName = uw("second")
> third = second.getNextOccurrence()
>- third.displayName = u"\u00FCthird"
>+ third.displayName = uw("third")
>
>- second.changeThisAndFuture('displayName', u'\u00FCchanged title')
>+ second.changeThisAndFuture('displayName', uw('changed title'))
>
> self.assertNotEqual(self.event.icalUID, second.icalUID)
> self.assertEqual(second.icalUID, third.icalUID)
>@@ -466,17 +467,17 @@
> event = self.event
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
>
>-
>+
> # check a simple recurring rule
> event.removeRecurrence()
> self._checkDeleted(chain(event.occurrences, [rruleset]), [event])
>-
>+
> # THIS modification
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> event.getNextOccurrence().displayName = 'changed'
> event.removeRecurrence()
> self._checkDeleted(chain(event.occurrences, [rruleset]), [event])
>-
>+
> # THIS modification to master
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> event.displayName = 'changed'
>@@ -484,15 +485,15 @@
> master = event.occurrenceFor
> self._checkDeleted(chain([master], master.occurrences, [rruleset]),
> [event])
>-
>+
> # THISANDFUTURE modification
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> second = event.getNextOccurrence()
>- second.changeThisAndFuture('displayName', u'\u00FCchanged')
>+ second.changeThisAndFuture('displayName', uw('changed'))
> event.removeRecurrence()
> self._checkDeleted([rruleset, event, second, second.rruleset],
> [event, second, second.rruleset])
>-
>+
> # simple deleteThis
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> second = event.getNextOccurrence()
>@@ -508,7 +509,7 @@
> self.assertEqual(rruleset.exdates, [self.start])
> self.assertEqual(event.occurrenceFor, None)
> event.removeRecurrence()
>-
>+
> # deleteThis on a THIS modification
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> second = event.getNextOccurrence()
>@@ -517,7 +518,7 @@
> self.assert_(second.isDeleted())
> self.assertEqual(rruleset.exdates, [self.start + timedelta(days=7)])
> event.removeRecurrence()
>-
>+
> # simple deleteAll
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> second = event.getNextOccurrence()
>@@ -533,37 +534,37 @@
> # deleteAll on a modification to master
> event = self._createEvent()
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
>- event.changeThis('displayName', u'\u00FCmodification to master')
>+ event.changeThis('displayName', uw('modification to master'))
> newmaster = event.occurrenceFor
> event.deleteAll()
> self._checkDeleted([rruleset, event, newmaster], [])
>-
>+
> # deleteThisAndFuture
> event = self._createEvent()
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
> second = event.getNextOccurrence()
> third = second.getNextOccurrence()
>- third.changeThis('displayName', u"\u00FCChanged title")
>+ third.changeThis('displayName', uw("Changed title"))
> third.deleteThisAndFuture()
>
> self._checkDeleted([event, second, third], [event])
> self.assertEqual(event.getLastUntil(), self.start + timedelta(days=7))
>-
>-
>
>+
>+
> def testRdatesAndExdates(self):
> event = self.event
> rruleset = event.rruleset = self._createRuleSetItem('weekly')
>-
>+
> # create an RDATE and an EXDATE
> rruleset.rdates = [self.start + timedelta(days=1)]
> extraDay = event.getNextOccurrence()
>- extraDay.changeThis('displayName', u'\u00FCExtra day')
>+ extraDay.changeThis('displayName', uw('Extra day'))
> self.assertEqual(extraDay.startTime, self.start + timedelta(days=1))
> rruleset.exdates = [self.start + timedelta(days=7)]
> twoWeeks = extraDay.getNextOccurrence()
> self.assertEqual(twoWeeks.startTime, self.start + timedelta(days=14))
>-
>+
> extraDay.changeThisAndFuture('startTime',
> extraDay.startTime + timedelta(hours=1))
> self.assertEqual(rruleset.rdates, [])
>@@ -573,7 +574,7 @@
> [self.start + timedelta(days=1, hours=1)])
> self.assertEqual(extraDay.rruleset.exdates,
> [self.start + timedelta(days=7, hours=1)])
>-
>+
> def testAllDay(self):
> event = self.event
> event.allDay = True
>@@ -591,21 +592,21 @@
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleSetItem.addRule(ruleItem)
> self.event.rruleset = ruleSetItem
>-
>+
> # make a THISANDFUTURE modification
>-
>+
> second = self.event.getNextOccurrence()
> second.changeThisAndFuture('startTime',
> self.start + timedelta(minutes=30))
> self.failIf(second.rruleset.rrules.first().hasLocalAttributeValue('until'))
>-
>+
> class NaiveTimeZoneRecurrenceTest(TestContentModel.ContentModelTestCase):
> """Test of recurring events that have startTimes that occur on different
> dates depending on whether timezone UI is enabled"""
>
> tzinfo = ICUtzinfo.getInstance("US/Pacific")
> enableTimeZones = False
>-
>+
> def setUp(self):
> # We want to set up the default timezone, and whether we're
> # in timezone-free mode, so that these tests are predictable.
>@@ -614,54 +615,54 @@
> # need to save this global state at test start, and
> # restore it once we're done (i.e. in tearDown()).
> super(NaiveTimeZoneRecurrenceTest, self).setUp()
>-
>+
> tzPrefs = schema.ns('osaf.app', self.rep.view).TimezonePrefs
>-
>+
> # Stash away the global values
> self._saveTzinfo = ICUtzinfo.default
> self._saveTzEnabled = tzPrefs.showUI
>-
>+
> # ... and set up the values we want to run the test with
> ICUtzinfo.default = self.tzinfo
> tzPrefs.showUI = self.enableTimeZones
>-
>+
> # 2006/04/09 05:00 Europe/London == 2006/04/08 US/Pacific
> start = datetime(2006, 4, 9, 5, 0,
> tzinfo = ICUtzinfo.getInstance("Europe/London"))
>-
>+
> # Make a weekly event with the above as the startTime, and
> # stash it in self.event
> self.event = Calendar.CalendarEvent(None, itsView=self.rep.view)
> self.event.startTime = start
> self.event.duration = timedelta(hours=2)
> self.event.anyTime = False
>- self.event.displayName = u"\u00FCSneaky recurring event"
>+ self.event.displayName = uw("Sneaky recurring event")
>
> ruleItem = RecurrenceRule(None, itsView=self.rep.view, freq='weekly')
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.rep.view)
> ruleSetItem.addRule(ruleItem)
> self.event.rruleset = ruleSetItem
>-
>+
> def tearDown(self):
> tzPrefs = schema.ns('osaf.app', self.rep.view).TimezonePrefs
>
> # Put everything back nicely....
> ICUtzinfo.default = self._saveTzinfo
> tzPrefs.showUI = self._saveTzEnabled
>-
>+
> # ... and tip-toe out the room. Move along, nothing to see here.
> super(NaiveTimeZoneRecurrenceTest, self).tearDown()
>-
>-
>+
>+
> def testEdgeCases(self):
>-
>+
> oneWeek = timedelta(weeks=1)
>
> # OK, start on April 9, and get the occurrences in the next week.
> # (Since timezones are disabled here, we are supposed to be ignoring
> # them in comparisons, and expect self.event to appear here).
> rangeStart = datetime(2006, 4, 9, tzinfo=ICUtzinfo.floating)
>-
>+
> occurrences = self.event.getOccurrencesBetween(rangeStart,
> rangeStart + oneWeek)
> self.failUnlessEqual(occurrences, [self.event])
>@@ -670,7 +671,7 @@
> occurrences = self.event.getOccurrencesBetween(rangeStart - oneWeek,
> rangeStart)
> self.failUnlessEqual(occurrences, [])
>-
>+
> # ... and lastly check that 1 event occurs in the week after April
> # 9, and that its startTime is exactly a week after the starting
> # event.
>@@ -689,17 +690,17 @@
> enableTimeZones = True
>
> def testEdgeCases(self):
>-
>+
> rangeStart = datetime(2006, 4, 9, tzinfo=ICUtzinfo.floating)
> oneWeek = timedelta(weeks=1)
>-
>+
> # Here, we expect events to occur according to the usual
> # rules of datetime objects. So, in the week of April 9,
> # there will be an occurrence on the 15th (i.e. which occurs
> # at 5 a.m. on the 16th in Europe/London).
> occurrences = self.event.getOccurrencesBetween(rangeStart,
> rangeStart + oneWeek)
>-
>+
> self.failUnlessEqual(len(occurrences), 1)
> self.failUnlessEqual(occurrences[0].startTime,
> self.event.startTime + oneWeek)
>@@ -709,7 +710,7 @@
> occurrences = self.event.getOccurrencesBetween(rangeStart - oneWeek,
> rangeStart)
> self.failUnlessEqual(occurrences, [self.event])
>-
>+
> # Lastly, make sure no events occur in the week preceding April 2nd.
> occurrences = self.event.getOccurrencesBetween(rangeStart - oneWeek,
> rangeStart - 2*oneWeek)
>@@ -748,7 +749,7 @@
> dialog box has been requested
> queue dialog box
> when dialog box is clicked
>-
>+
> registry of proxies
> foo.registerProxy(CalendarEventMixin, CalendarEventMixinProxy)
> proxy = foo.getProxiedItem(item)
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/calendar/tests/TestReminders.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/calendar/tests/TestReminders.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/calendar/tests/TestReminders.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -6,31 +6,31 @@
> import repository.item
> from datetime import datetime, timedelta
>
>-class ReminderTestCase(TestContentModel.ContentModelTestCase):
>+class ReminderTestCase(TestContentModel.ContentModelTestCase):
> def testReminders(self):
> # Make an event and add a reminder to it.
>- anEvent = CalendarEvent("calendarEventItem", itsView=self.rep.view,
>+ anEvent = CalendarEvent("calendarEventItem", itsView=self.rep.view,
> startTime=datetime(2005,3,8,12,00,
> tzinfo = ICUtzinfo.default),
> duration=timedelta(hours=1),
> allDay=False, anyTime=False)
> regularReminder = anEvent.makeReminder(timedelta(minutes=-10))
>-
>+
> # Make sure it all got connected correctly
> self.failUnless(len(anEvent.reminders) == 1 \
> and anEvent.reminders.first() is regularReminder)
>- self.failIf(len(anEvent.expiredReminders))
>- self.failUnless(anEvent.reminderFireTime == datetime(2005,3,8,11,50,
>+ self.failIf(len(anEvent.expiredReminders))
>+ self.failUnless(anEvent.reminderFireTime == datetime(2005,3,8,11,50,
> tzinfo = ICUtzinfo.default))
>
> # Snooze the reminder for 5 minutes.
>- snoozeReminder = anEvent.snoozeReminder(regularReminder,
>+ snoozeReminder = anEvent.snoozeReminder(regularReminder,
> timedelta(minutes=5))
> # (should move the old reminder to expired)
> self.failUnless(list(anEvent.expiredReminders) == [ regularReminder ])
> self.failUnless(list(anEvent.reminders) == [ snoozeReminder ])
> self.failUnless(snoozeReminder.reminderItems.first() is not None)
>-
>+
> # Dismiss the snoozed reminder
> anEvent.dismissReminder(snoozeReminder)
> # (should destroy the snoozed reminder, leaving only the expired one)
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/calendar/tests/TestTimeZone.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/calendar/tests/TestTimeZone.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/calendar/tests/TestTimeZone.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -15,14 +15,14 @@
>
> def testGetTimeZone(self):
> self.failIfEqual(self.tzInfoItem.default, None)
>-
>+
> def testSetTimeZone(self):
> self.tzInfoItem.default = PyICU.ICUtzinfo.getInstance("US/Pacific")
> self.failUnlessEqual(self.tzInfoItem.default.timezone.getID(), "US/Pacific")
>
> self.tzInfoItem.default = PyICU.ICUtzinfo.getInstance("US/Eastern")
> self.failUnlessEqual(self.tzInfoItem.default.timezone.getID(), "US/Eastern")
>-
>+
> class DefaultTimeZoneTestCase(TimeZoneTestCase):
> def testGetTimeZone(self):
> super(DefaultTimeZoneTestCase, self).testGetTimeZone()
>@@ -31,7 +31,7 @@
> def testSetTimeZone(self):
> self.tzInfoItem.default = PyICU.ICUtzinfo.getInstance("US/Eastern")
> self.failUnlessEqual(PyICU.ICUtzinfo.default, self.tzInfoItem.default)
>-
>+
> class CanonicalTimeZoneTestCase(RepositoryTestCase):
> def setUp(self):
> super(CanonicalTimeZoneTestCase, self).setUp(True)
>@@ -40,28 +40,28 @@
> def testEquivalent(self):
> tz = PyICU.ICUtzinfo.getInstance("PST")
> canonicalTz = TimeZoneInfo.get(self.rep.view).canonicalTimeZone(tz)
>-
>+
> self.failUnlessEqual(canonicalTz.tzid, "US/Pacific")
>
> def testNew(self):
> tz = PyICU.ICUtzinfo.getInstance("America/Caracas")
> info = TimeZoneInfo.get(self.rep.view)
> canonicalTz = info.canonicalTimeZone(tz)
>-
>+
> self.failUnless(canonicalTz is tz)
> self.failUnless(tz.tzid in info.wellKnownIDs)
>-
>+
> def testNone(self):
> info = TimeZoneInfo.get(self.rep.view)
> canonicalTz = info.canonicalTimeZone(None)
>-
>+
> self.failUnless(canonicalTz is PyICU.ICUtzinfo.floating)
>-
>+
> class KnownTimeZonesTestCase(RepositoryTestCase):
> def setUp(self):
> super(KnownTimeZonesTestCase, self).setUp(True)
> self.info = TimeZoneInfo.get(self.rep.view)
>-
>+
> def testKnownTimeZones(self):
> numZones = 0
> for name, tz in self.info.iterTimeZones():
>@@ -78,14 +78,14 @@
> def testGetTimeZone(self):
> # [Bug 5209] The timezone now defaults to floating
> defaultTzItem = TimeZoneInfo.get(self.rep.view)
>-
>+
> self.failUnlessEqual(defaultTzItem.default,
> PyICU.ICUtzinfo.floating)
>
> def testPerView(self):
> defaultTzItemOne = TimeZoneInfo.get(self.rep.view)
> defaultTzItemTwo = TimeZoneInfo.get(self.rep.createView('two'))
>-
>+
> self.failIf(defaultTzItemOne is defaultTzItemTwo)
>
> def testTimeZoneSaved(self):
>@@ -104,12 +104,12 @@
>
> # - Change the DefaultTimeZone default timezone
> PyICU.TimeZone.setDefault(PyICU.TimeZone.createTimeZone("US/Pacific"))
>-
>+
> # - Reopen the repo
> self._reopenRepository()
> view = self.rep.view
> self.manager = None
>-
>+
> # - Now check the default timezone
> defaultTzItem = TimeZoneInfo.get(view)
> # ... see that it changed to what's in the repo
>@@ -122,10 +122,10 @@
> class AbstractTimeZoneTestCase(unittest.TestCase):
> def setUp(self):
> super(AbstractTimeZoneTestCase, self).setUp()
>-
>+
> self.oldLocale = PyICU.Locale.getDefault()
> self.oldTzinfo = PyICU.ICUtzinfo.default
>-
>+
> def tearDown(self):
> if self.oldLocale is not None:
> PyICU.Locale.setDefault(self.oldLocale)
>@@ -178,8 +178,8 @@
> PyICU.Locale.setDefault(PyICU.Locale.getFrance())
> PyICU.TimeZone.setDefault(
> PyICU.ICUtzinfo.getInstance("Europe/Paris").timezone)
>-
>
>+
> def testNoTimeZone(self):
> dt = datetime(1999, 1, 2, 13, 46)
> self.failUnlessEqual(formatTime(dt), "13:46")
>@@ -207,25 +207,25 @@
> super(StripTimeZoneTestCase, self).setUp()
> PyICU.TimeZone.setDefault(
> PyICU.ICUtzinfo.getInstance("US/Pacific").timezone)
>-
>+
> def testStripNaiveDatetime(self):
> """ Test that stripTimeZone() works on a naive datetime"""
> dt = datetime(2003, 9, 17, 2, 11, tzinfo = None)
>-
>+
> self.failUnlessEqual(stripTimeZone(dt), dt)
>-
>
>+
> def testStripOtherDatetime(self):
> """ Test that stripTimeZone() works on a datetime in
> a timezone that's not the default"""
> dt = datetime(2012, 4, 28, 18, 4,
> tzinfo = PyICU.ICUtzinfo.getInstance("Asia/Beijing"))
> strippedDt = stripTimeZone(dt)
>-
>+
> self.failUnless(strippedDt.tzinfo is None)
>-
>+
> dtInDefault = dt.astimezone(PyICU.ICUtzinfo.default)
>-
>+
> self.failUnlessEqual(strippedDt.date(), dtInDefault.date())
> self.failUnlessEqual(strippedDt.time(), dtInDefault.time())
>
>@@ -234,7 +234,7 @@
> the default timezone """
> dt = datetime(2012, 4, 28, 18, 4, tzinfo = PyICU.ICUtzinfo.default)
> strippedDt = stripTimeZone(dt)
>-
>+
> self.failUnless(strippedDt.tzinfo is None)
> self.failUnlessEqual(strippedDt.date(), dt.date())
> self.failUnlessEqual(strippedDt.time(), dt.time())
>@@ -247,14 +247,14 @@
>
> def testCoerceNaiveToNaive(self):
> dt = datetime(2014, 10, 28, 2, 11, tzinfo = None)
>-
>+
> self.failUnlessEqual(coerceTimeZone(dt, None), dt)
>
> def testCoerceNaiveToDefault(self):
> dt = datetime(2002, 1, 3, 19, 57, 41, tzinfo = None)
> tzinfo = PyICU.ICUtzinfo.default
> coercedDt = coerceTimeZone(dt, tzinfo)
>-
>+
> self.failUnlessEqual(coercedDt.tzinfo, tzinfo)
> self.failUnlessEqual(dt.date(), coercedDt.date())
> self.failUnlessEqual(dt.time(), coercedDt.time())
>@@ -263,9 +263,9 @@
> dt = datetime(2012, 4, 28, 18, 4, tzinfo = None)
> tzinfo = PyICU.ICUtzinfo.getInstance("Asia/Tokyo")
> coercedDt = coerceTimeZone(dt, tzinfo)
>-
>+
> self.failUnlessEqual(coercedDt.tzinfo, tzinfo)
>-
>+
> compareDt = coercedDt.astimezone(PyICU.ICUtzinfo.default)
> self.failUnlessEqual(dt.date(), compareDt.date())
> self.failUnlessEqual(dt.time(), compareDt.time())
>@@ -273,7 +273,7 @@
> def testCoerceDefaultToNaive(self):
> dt = datetime(2014, 10, 28, 2, 11,
> tzinfo=PyICU.ICUtzinfo.default)
>-
>+
> coercedDt = coerceTimeZone(dt, None)
> self.failUnlessEqual(dt.date(), coercedDt.date())
> self.failUnlessEqual(dt.time(), coercedDt.time())
>@@ -283,7 +283,7 @@
> tzinfo=PyICU.ICUtzinfo.default)
> tzinfo = PyICU.ICUtzinfo.default
> coercedDt = coerceTimeZone(dt, tzinfo)
>-
>+
> self.failUnlessEqual(coercedDt.tzinfo, tzinfo)
> self.failUnlessEqual(coercedDt, dt)
>
>@@ -300,10 +300,10 @@
> def testCoerceOtherToNaive(self):
> dt = datetime(2014, 10, 28, 2, 11,
> tzinfo=PyICU.ICUtzinfo.getInstance("Africa/Johannesburg"))
>-
>+
> coercedDt = coerceTimeZone(dt, None)
> self.failUnless(coercedDt.tzinfo is None)
>-
>+
> compareDt = dt.astimezone(PyICU.ICUtzinfo.default)
> self.failUnlessEqual(compareDt.date(), coercedDt.date())
> self.failUnlessEqual(compareDt.time(), coercedDt.time())
>@@ -313,7 +313,7 @@
> tzinfo=PyICU.ICUtzinfo.getInstance("Africa/Johannesburg"))
> tzinfo = PyICU.ICUtzinfo.default
> coercedDt = coerceTimeZone(dt, tzinfo)
>-
>+
> self.failUnlessEqual(coercedDt.tzinfo, tzinfo)
> self.failUnlessEqual(coercedDt, dt)
>
>@@ -321,7 +321,7 @@
> tzinfo = PyICU.ICUtzinfo.getInstance("Africa/Johannesburg")
> dt = datetime(2002, 1, 3, 19, 57, 41, tzinfo=tzinfo)
> coercedDt = coerceTimeZone(dt, tzinfo)
>-
>+
> self.failUnlessEqual(coercedDt.tzinfo, tzinfo)
> self.failUnlessEqual(coercedDt, dt)
>
>
>
> Modified: trunk/chandler/parcels/osaf/pim/generate.py (10797
> => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/generate.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/generate.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -15,28 +15,17 @@
> import osaf.pim.calendar.Calendar as Calendar
> import osaf.pim.mail as Mail
> import i18n
>+from i18n.tests import uw
> from application import schema
>
> TEST_I18N = 'test' in i18n.getLocaleSet()
>-I18N_SEED = u"\u0439\u03b4"
>
>-HEADLINES = [u"Dinner", u"Lunch", u"Meeting", u"Movie", u"Games"]
>+HEADLINES = ["Dinner", "Lunch", "Meeting", "Movie", "Games"]
>
> DURATIONS = [60, 90, 120, 150, 180]
>
> REMINDERS = [None, None, None, None, 1, 10] # The "None"s make only a 30% chance an event will have a reminder...
>
>-def addSurrogatePairToText(text):
>- #One in two chance. If the rand int return equals 1
>- #then add a surrogate pair at the start and end of the text
>- if random.randrange(2) == 1:
>- size = len(I18N_SEED)
>- start = random.randrange(size)
>- end = random.randrange(size)
>- return u"%s%s%s" % (I18N_SEED[start], text, I18N_SEED[end])
>- return text
>-
>-
> def GenerateCalendarParticipant(view):
> email = Mail.EmailAddress(itsView=view)
> domainName = random.choice(DOMAIN_LIST)
>@@ -53,7 +42,7 @@
> event.displayName = random.choice(HEADLINES)
>
> if TEST_I18N:
>- event.displayName = addSurrogatePairToText(event.displayName)
>+ event.displayName = uw(event.displayName)
>
> # Choose random days, hours
> startDelta = timedelta(days=random.randint(0, days),
>@@ -83,7 +72,7 @@
> # Add a location to 2/3 of the events
> if random.randrange(3) > 0:
> if TEST_I18N:
>- event.location = Calendar.Location.getLocation(view, addSurrogatePairToText(random.choice(LOCATIONS)))
>+ event.location = Calendar.Location.getLocation(view, uw(random.choice(LOCATIONS)))
> else:
> event.location = Calendar.Location.getLocation(view, random.choice(LOCATIONS))
>
>@@ -125,7 +114,7 @@
> message.subject = random.choice(TITLES)
>
> if TEST_I18N:
>- message.subject = addSurrogatePairToText(message.subject)
>+ message.subject = uw(message.subject)
>
> message.dateSent = datetime.now(tzinfo)
>
>@@ -156,9 +145,9 @@
> body += M_BOTH
>
> if TEST_I18N:
>- body = addSurrogatePairToText(body)
>+ body = uw(body)
>
>- message.body = message.getAttributeAspect('body', 'type').makeValue(body)
>+ message.body = body
> message.triageStatus = random.choice(pim.TriageEnum.values)
>
> return message
>@@ -169,7 +158,7 @@
> note.displayName = random.choice(TITLES)
>
> if TEST_I18N:
>- note.displayName = addSurrogatePairToText(note.displayName)
>+ note.displayName = uw(note.displayName)
>
> delta = timedelta(days=random.randint(0, 5),
> hours=random.randint(0, 24))
>@@ -186,7 +175,7 @@
> task.displayName = random.choice(TITLES)
>
> if TEST_I18N:
>- task.displayName = addSurrogatePairToText(task.displayName)
>+ task.displayName = uw(task.displayName)
>
> task.triageStatus = random.choice(pim.TriageEnum.values)
> return task
>@@ -252,8 +241,8 @@
> name.lastName = random.choice(LASTNAMES)
>
> if TEST_I18N:
>- name.firstName = addSurrogatePairToText(name.firstName)
>- name.lastName = addSurrogatePairToText(name.lastName)
>+ name.firstName = uw(name.firstName)
>+ name.lastName = uw(name.lastName)
>
> return name
>
>@@ -271,7 +260,7 @@
> potentialName = random.choice(COLLECTION_NAMES)
>
> if TEST_I18N:
>- potentialName = addSurrogatePairToText(potentialName)
>+ potentialName = uw(potentialName)
>
> if existingNames is None or potentialName not in existingNames:
> collection.displayName = potentialName
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/tests/TestCalendar.py (10797
> => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestCalendar.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestCalendar.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -15,6 +15,7 @@
> import repository.item
>
> from repository.util.Path import Path
>+from i18n.tests import uw
>
>
> class CalendarTest(TestContentModel.ContentModelTestCase):
>@@ -28,34 +29,34 @@
> self.loadParcel("osaf.pim.calendar")
>
> def _verifyCalendarEvent(event):
>- self.assertEqual(event.displayName, u"\u00FCsimple headline")
>- self.assertEqual(event.getItemDisplayName(), u"\u00FCsimple headline")
>+ self.assertEqual(event.displayName, uw("simple headline"))
>+ self.assertEqual(event.getItemDisplayName(), uw("simple headline"))
>
> self.assertEqual(event.importance, 'fyi')
> self.assertEqual(event.getAttributeValue('importance'), 'fyi')
>
> self.assertEqual(event.transparency, "confirmed")
> self.assertEqual(event.getAttributeValue('transparency'), "confirmed")
>-
>+
> self.assertEqual(event.allDay, False)
> self.assertEqual(event.getAttributeValue('allDay'), False)
>-
>+
> self.assertEqual(event.anyTime, True)
> self.assertEqual(event.getAttributeValue('anyTime'), True)
>
> def _verifyCalendarItems(calendar, location, recurrence):
>- self.assertEqual(calendar.displayName, u"\u00FCsimple calendar")
>+ self.assertEqual(calendar.displayName, uw("simple calendar"))
> self.assertEqual(calendar.getAttributeValue('displayName'),
>- u"\u00FCsimple calendar")
>+ uw("simple calendar"))
>
>- self.assertEqual(location.displayName, u"\u00FCsimple location")
>+ self.assertEqual(location.displayName, uw("simple location"))
> self.assertEqual(location.getAttributeValue('displayName'),
>- u"\u00FCsimple location")
>+ uw("simple location"))
>
> # Check that the globals got created by the parcel
> calendarPath = Path('//parcels/osaf/pim/calendar')
> view = self.rep.view
>-
>+
> self.assertEqual(Calendar.CalendarEvent.getKind(view),
> view.find(Path(calendarPath, 'CalendarEvent')))
> self.assertEqual(Calendar.Calendar.getKind(view),
>@@ -73,14 +74,14 @@
> recurrenceItem = Calendar.RecurrencePattern("recurrenceItem", itsView=view)
>
> # CalendarEvent properties
>- calendarEventItem.displayName = u"\u00FCsimple headline"
>+ calendarEventItem.displayName = uw("simple headline")
> calendarEventItem.importance = "fyi"
> _verifyCalendarEvent(calendarEventItem)
> calendarEventItem.location = locationItem
>
> # Calendar properties
>- calendarItem.displayName = u"\u00FCsimple calendar"
>- locationItem.displayName = u"\u00FCsimple location"
>+ calendarItem.displayName = uw("simple calendar")
>+ locationItem.displayName = uw("simple location")
> _verifyCalendarItems(calendarItem, locationItem,
> recurrenceItem)
>
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/tests/TestCollections.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestCollections.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestCollections.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -2,6 +2,7 @@
> from osaf.pim.collections import *
> from osaf import pim
> from repository.persistence.DBRepository import DBRepository
>+from i18n.tests import uw
>
> class NotifyHandler(schema.Item):
> """
>@@ -14,7 +15,7 @@
> def checkLog(self, op, item, other, index=-1):
> if len(self.log) == 0:
> return False
>-
>+
> # skip 'changed' entries unless we are looking for changes
> # this is due to mixing of _dispatchChanges in
> # view.dispatchNotifcations()
>@@ -34,19 +35,19 @@
> A dirt simple item -- think content item here, if you like
> """
>
>- label = schema.One(schema.Text, displayName=u"\u00FCMy Label")
>+ label = schema.One(schema.Text, displayName=uw("My Label"))
> collections = schema.Sequence(otherName='inclusions')
> appearsIn = schema.Sequence(otherName='set')
>
> class ChildSimpleItem(SimpleItem):
>- childData = schema.One(schema.Text, displayName=u"\u00FCChild data")
>+ childData = schema.One(schema.Text, displayName=uw("Child data"))
>
> class OtherSimpleItem(schema.Item):
> """
> Another dirt simple item -- think content item here, if you like
> """
>
>- label = schema.One(schema.Text, displayName=u"\u00FCMy Label")
>+ label = schema.One(schema.Text, displayName=uw("My Label"))
> collections = schema.Sequence(otherName='inclusions')
> appearsIn = schema.Sequence(otherName='set')
>
>@@ -76,10 +77,15 @@
>
> def setUp(self):
> super(CollectionTests, self).setUp()
>- self.i = SimpleItem('i', label=u'\u00FCi', itsView=self.view)
>- self.i1 = SimpleItem('i1',label=u'\u00FCi2', itsView=self.view)
>- self.i2 = SimpleItem('i2',label=u'\u00FCi3', itsView=self.view)
>
>+ #Theses values are used as part of an indexed collection.
>+ #Thus the ordering needs to remain the same between runs.
>+ #The uw() syntax is not used here since it will change the
>+ #comparison sort order from run to run.
>+ self.i = SimpleItem('i', label=u"\u00FCi", itsView=self.view)
>+ self.i1 = SimpleItem('i1',label=u"\u00FCi2", itsView=self.view)
>+ self.i2 = SimpleItem('i2',label=u"\u00FCi3", itsView=self.view)
>+
> self.b1 = ListCollection('b1', itsView=self.view)
> self.b2 = ListCollection('b2', itsView=self.view)
>
>@@ -151,7 +157,7 @@
> u.removeSource(self.b2)
> self.view.dispatchNotifications()
> self.failUnless(self.nh.checkLog("remove",u,self.i1.itsUUID))
>-
>+
> print [ i for i in u ]
>
> def testDifference(self):
>@@ -178,7 +184,7 @@
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("add", self.b2, self.i2))
> self.failIf(self.nh1.checkLog("add", d, self.i2))
>- self.failIf(self.nh1.checkLog("remove", d, self.i2))
>+ self.failIf(self.nh1.checkLog("remove", d, self.i2))
>
> self.b2.add(self.i)
> self.view.dispatchNotifications()
>@@ -214,9 +220,9 @@
> inclusions.add(it)
> self.view.dispatchNotifications()
> self.failUnless(self.nh.checkLog("add", inclusions, it))
>- self.failUnless(nh3.checkLog("add", ic, it))
>+ self.failUnless(nh3.checkLog("add", ic, it))
>
>- nancy = SimpleItem("nancy", label=u"\u00FCnancy", itsView=self.view)
>+ nancy = SimpleItem("nancy", label=uw("nancy"), itsView=self.view)
> self.view.dispatchNotifications()
> self.failUnless(self.nh1.checkLog("add", rule, nancy))
> self.assertEqual(len(list(rule)), 4)
>@@ -226,7 +232,7 @@
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("add", exclusions, self.i2))
> self.failUnless(nh3.checkLog("remove", ic, self.i2))
>-
>+
> exclusions.remove(self.i2)
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("remove", exclusions, self.i2))
>@@ -288,7 +294,7 @@
> self.failUnless(self.nh.checkLog("add", self.b1, self.i2))
> self.failIf(self.nh1.checkLog("add", f1, self.i2))
>
>- ted = SimpleItem("ted", label=u"\u00FCted", itsView=self.view)
>+ ted = SimpleItem("ted", label=uw("ted"), itsView=self.view)
> self.b1.add(ted)
> self.view.dispatchNotifications()
> self.failUnless(self.nh.checkLog("add", self.b1, ted))
>@@ -302,29 +308,29 @@
> kind=self.i.itsKind)
> f2 = FilteredCollection(itsView=self.view,
> source=k1,
>- filterExpression=u"len(view[uuid].label) > 3",
>+ filterExpression=u"len(view[uuid].label) > 4",
> filterAttributes=["label"])
> nh3 = NotifyHandler("nh3", itsView=self.view)
>
> k1.notificationQueueSubscribe(self.nh2)
> f2.notificationQueueSubscribe(nh3)
>
>- fred = SimpleItem("fred", label=u"\u00FCfred", itsView=self.view)
>+ fred = SimpleItem("fred", label=uw("fred"), itsView=self.view)
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("add", k1, fred))
> self.failUnless(nh3.checkLog("add", f2, fred))
>
>- john = SimpleItem("john", label=u"\u00FCjohn", itsView=self.view)
>+ john = SimpleItem("john", label=uw("john"), itsView=self.view)
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("add", k1, john))
> self.failUnless(nh3.checkLog("add", f2, john))
>
>- karen = SimpleItem("karen", label=u"\u00FCkaren", itsView=self.view)
>+ karen = SimpleItem("karen", label=uw("karen"), itsView=self.view)
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("add", k1, karen))
> self.failUnless(nh3.checkLog("add", f2, karen))
>
>- x = SimpleItem("x", label=u"\u00FCx", itsView=self.view)
>+ x = SimpleItem("x", label=uw("x"), itsView=self.view)
> self.view.dispatchNotifications()
> self.failUnless(self.nh2.checkLog("add", k1, x))
> self.failIf(nh3.checkLog("add", f2, x))
>@@ -335,7 +341,7 @@
> # print nh3.log[-1], len(nh3.log)
> # print "setting label"
> # print x.label
>- x.label = u"\u00FCxxxx"
>+ x.label = uw("xxxx")
> # print x.label
>
> pos = len(nh3.log)
>@@ -363,7 +369,7 @@
> self.failUnless(x in k1)
> self.failIf(x not in f2)
>
>- x.label=u"\u00FCzzz"
>+ x.label=uw("zzz")
>
>
> def testFilteredDelete(self):
>@@ -382,7 +388,7 @@
> k1.notificationQueueSubscribe(self.nh2)
> f2.notificationQueueSubscribe(nh3)
>
>- self.i.label = u"\u00FCxxx"
>+ self.i.label = uw("xxx")
> print nh3.log
> self.view.dispatchNotifications()
>
>@@ -393,7 +399,7 @@
> changed = True
> break
> self.failUnless(changed)
>- self.assertEqual(self.i.label,u"\u00FCxxx")
>+ self.assertEqual(self.i.label,uw("xxx"))
>
> delattr(self.i,"label")
> self.view.dispatchNotifications()
>@@ -410,30 +416,30 @@
>
> f = FilteredCollection(itsView=self.view,
> source=k,
>- filterExpression=u"len(view[uuid].label) > 2",
>+ filterExpression=u"len(view[uuid].label) > 3",
> filterAttributes=["label"])
>-
>+
> l = ListCollection(itsView=self.view)
>-
>+
> u = UnionCollection(itsView=self.view)
> u.notificationQueueSubscribe(self.nh)
>-
>+
> u.addSource(f)
> u.addSource(l)
> self.view.dispatchNotifications()
>-
>- self.i.label = u"\u00FCabcd"
>+
>+ self.i.label = uw("abcd")
> self.view.dispatchNotifications()
>- self.failUnless(self.nh.checkLog('add', u, self.i))
>+ self.failUnless(self.nh.checkLog('add', u, self.i))
>
>- self.i.label = u"\u00FCdefg"
>+ self.i.label = uw("defg")
> self.view.dispatchNotifications()
>- self.failUnless(self.nh.checkLog('changed', u, self.i))
>+ self.failUnless(self.nh.checkLog('changed', u, self.i))
>
>- self.i.label = u"\u00FCa"
>+ self.i.label = uw("a")
> self.view.dispatchNotifications()
>- self.failUnless(self.nh.checkLog('remove', u, self.i))
>-
>+ self.failUnless(self.nh.checkLog('remove', u, self.i))
>+
> def testNumericIndex(self):
> k = KindCollection(itsView=self.view,
> kind=self.i.itsKind)
>@@ -441,7 +447,7 @@
> testCollection = IndexedSelectionCollection(itsView=self.view,
> source=k)
> for i in ["z", "y", "x", "w", "v"]:
>- it = SimpleItem(i, label=u"\u00FC%s" % i, itsView=self.view)
>+ it = SimpleItem(i, label=uw(i), itsView=self.view)
>
> #@@@ this is a bug in len -- if you compute the length before you
> #create any indexes, you are out of luck
>@@ -459,6 +465,12 @@
>
> testCollection = IndexedSelectionCollection(itsView=self.view,
> source=k)
>+
>+ #Theses values are used as part of an indexed collection.
>+ #Thus the ordering needs to remain the same between runs.
>+ #The uw() syntax is not used here since it will change the
>+ #comparison sort order from run to run.
>+
> for i in ["z", "y", "x", "w", "v"]:
> it = SimpleItem(i, label=u"\u00FC%s" % i, itsView=self.view)
>
>@@ -469,8 +481,10 @@
> self.assertEqual([testCollection[i].label for i in xrange(0, len(testCollection))],[u'\u00FCi',u'\u00FCi2',u'\u00FCi3',u'\u00FCv',u'\u00FCw',u'\u00FCx',u'\u00FCy',u'\u00FCz'])
>
> testCollection[len(testCollection)-1].label = u'\u00FCu'
>+
> self.assertEqual([testCollection[i].label for i in xrange(0, len(testCollection))],[u'\u00FCi',u'\u00FCi2',u'\u00FCi3',u'\u00FCu',u'\u00FCv',u'\u00FCw',u'\u00FCx',u'\u00FCy'])
>
>+
> def testDelayedCreation(self):
> uc = UnionCollection('u', itsView=self.view)
> uc.addSource(self.b1)
>@@ -553,7 +567,7 @@
> recursive=True)
> mine = UnionCollection(itsView=self.view)
> myNotes = IntersectionCollection(itsView=self.view, sources=(mine, notes))
>-
>+
> all = SmartCollection(itsView=self.view, source=myNotes,
> exclusions=trash, trash=None)
>
>@@ -563,7 +577,7 @@
> mine.addSource(coll2)
> coll3 = SmartCollection(itsView=self.view, trash=trash)
> mine.addSource(coll3)
>-
>+
> note = pim.Note(itsView=self.view)
>
> # note is only in a not-mine collection, so removing it from that
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/tests/TestContacts.py (10797
> => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestContacts.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestContacts.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -12,6 +12,7 @@
> from osaf.pim.contacts import Contact, ContactName
>
> from repository.util.Path import Path
>+from i18n.tests import uw
>
>
> class ContactsTest(TestContentModel.ContentModelTestCase):
>@@ -22,15 +23,15 @@
>
> self.loadParcel("osaf.pim.contacts")
> def _verifyContactName(name):
>- self.assertEqual(name.firstName, u'\u00FCSylvia')
>- self.assertEqual(name.getAttributeValue('firstName'),u'\u00FCSylvia')
>- self.assertEqual(name.lastName, u'\u00FCPlath')
>- self.assertEqual(name.getAttributeValue('lastName'), u'\u00FCPlath')
>+ self.assertEqual(name.firstName, uw('Sylvia'))
>+ self.assertEqual(name.getAttributeValue('firstName'),uw('Sylvia'))
>+ self.assertEqual(name.lastName, uw('Plath'))
>+ self.assertEqual(name.getAttributeValue('lastName'), uw('Plath'))
>
> # Test the globals
> contactsPath = Path('//parcels/osaf/pim/contacts')
> view = self.rep.view
>-
>+
> self.assertEqual(Contact.getKind(view),
> view.find(Path(contactsPath, 'Contact')))
> self.assertEqual(ContactName.getKind(view),
>@@ -45,8 +46,8 @@
> self.assertEqual(contactNameItem.itsKind, ContactName.getKind(view))
>
> # Literal properties
>- contactNameItem.firstName = u"\u00FCSylvia"
>- contactNameItem.lastName = u"\u00FCPlath"
>+ contactNameItem.firstName = uw("Sylvia")
>+ contactNameItem.lastName = uw("Plath")
>
> _verifyContactName(contactNameItem)
>
>@@ -57,7 +58,7 @@
>
> contactNameItem = contentItemParent.getItemChild("contactNameItem")
> _verifyContactName(contactNameItem)
>-
>+
> def testGeneratedContacts(self):
>
> self.loadParcels(["osaf.pim.contacts", "osaf.pim.mail"])
>@@ -65,7 +66,7 @@
> view = self.rep.view
> generate.GenerateItems(view, 100, generate.GenerateContact)
> view.commit()
>-
>
>+
> if __name__ == "__main__":
> unittest.main()
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/tests/TestContentModel.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestContentModel.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestContentModel.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -9,6 +9,7 @@
>
> import repository.tests.RepositoryTestCase as RepositoryTestCase
> import osaf.pim.items as items
>+from i18n.tests import uw
>
> class ContentModelTestCase(RepositoryTestCase.RepositoryTestCase):
> def setUp(self):
>@@ -58,7 +59,7 @@
> self.assertEqual(genericContentItem.itsParent, contentItemParent)
> self.assertEqual(genericProject.itsParent, contentItemParent)
> self.assertEqual(genericGroup.itsParent, contentItemParent)
>-
>+
> self.assertEqual(repr(genericContentItem.itsPath),
> '//userdata/genericContentItem')
> self.assertEqual(repr(genericProject.itsPath),
>@@ -67,26 +68,26 @@
> '//userdata/genericGroup')
>
> # Set and test simple attributes
>- genericContentItem.displayName = u"\u00FCTest Content Item"
>- genericContentItem.context = "work"
>- genericContentItem.body = u"\u00FCNotes appear in the body"
>+ genericContentItem.displayName = uw("Test Content Item")
>+ genericContentItem.context = uw("work")
>+ genericContentItem.body = uw("Notes appear in the body")
>
>- self.assertEqual(genericContentItem.displayName, u"\u00FCTest Content Item")
>- self.assertEqual(genericContentItem.context, "work")
>- self.assertEqual(genericContentItem.body, u"\u00FCNotes appear in the body")
>- self.assertEqual(genericContentItem.getItemDisplayName(), u"\u00FCTest Content Item")
>-
>+ self.assertEqual(genericContentItem.displayName, uw("Test Content Item"))
>+ self.assertEqual(genericContentItem.context, uw("work"))
>+ self.assertEqual(genericContentItem.body, uw("Notes appear in the body"))
>+ self.assertEqual(genericContentItem.getItemDisplayName(), uw("Test Content Item"))
>+
> # Test Calculated basedOn
> self.assertEqual(genericContentItem.getBasedAttributes('body'), ('body',))
>-
>- genericProject.name = u"\u00FCTest Project"
>- genericGroup.name = u"\u00FCTest Group"
>
>+ genericProject.name = uw("Test Project")
>+ genericGroup.name = uw("Test Group")
>
>- self.assertEqual(genericProject.name, u"\u00FCTest Project")
>- self.assertEqual(genericGroup.name, u"\u00FCTest Group")
>
>+ self.assertEqual(genericProject.name, uw("Test Project"))
>+ self.assertEqual(genericGroup.name, uw("Test Group"))
>
>+
> # Groups and projects aren't currently linked to Content Items
> # One of these days we'll have to figure out how to hook them
> # up or clean them out. --Lisa
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/tests/TestLocations.py (10797
> => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestLocations.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestLocations.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -11,6 +11,7 @@
> import osaf.pim.calendar.Calendar as Calendar
>
> from repository.util.Path import Path
>+from i18n.tests import uw
>
>
> class LocationsTest(TestContentModel.ContentModelTestCase):
>@@ -24,11 +25,11 @@
> # Test the globals
> locationsPath = Path('//parcels/osaf/pim/calendar')
> view = self.rep.view
>-
>+
> self.assertEqual(Calendar.Location.getKind(view),
> view.find(Path(locationsPath, 'Location')))
>
>- locationNames = [u"\u00FCAlderon", u"\u00FCAtlantis", u"\u00FCArcadia"]
>+ locationNames = [uw("Alderon"), uw("Atlantis"), uw("Arcadia")]
>
> # Construct sample items
> for loc in locationNames:
>@@ -45,7 +46,7 @@
> self.assertEqual(aRoom.itsKind, Calendar.Location.getKind(view))
>
> # Literal properties
>- aRoom.displayName = u"\u00FCA Nice Place" # change the Location name
>+ aRoom.displayName = uw("A Nice Place") # change the Location name
> # make sure we can get the name, and find it by that name
> sameLocation = Calendar.Location.getLocation (view, aRoom.displayName)
> self.assert_ (aRoom is sameLocation, "Location factory failed to return an identical location!")
>
>
> Modified: trunk/chandler/parcels/osaf/pim/tests/TestMail.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestMail.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestMail.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -13,6 +13,7 @@
> from datetime import datetime
> from repository.util.Path import Path
> from PyICU import ICUtzinfo
>+from i18n.tests import uw
>
> class MailTest(TestContentModel.ContentModelTestCase):
> """ Test Mail Content Model """
>@@ -151,7 +152,7 @@
> imapAccountItem = self.__populateAccount(imapAccountItem)
>
> mailDeliveryErrorItem.errorCode = 25
>- mailDeliveryErrorItem.errorString = u"\u00FCTest String"
>+ mailDeliveryErrorItem.errorString = uw("Test String")
> mailDeliveryErrorItem.errorDate = datetime.now(ICUtzinfo.default)
>
> smtpDeliveryItem.state = "DRAFT"
>@@ -166,7 +167,7 @@
> # Literal properties
> mailMessageItem.dateSent = datetime.now(ICUtzinfo.default)
> mailMessageItem.dateReceived = datetime.now(ICUtzinfo.default)
>- mailMessageItem.subject = u"\u00FCHello"
>+ mailMessageItem.subject = uw("Hello")
> mailMessageItem.spamScore = 5
>
> # Item Properties
>@@ -189,18 +190,18 @@
> #XXX: i18n usernames and passwords can be non-ascii.
> # Need to investigate how best to deal with this as
> # there is no standard. It is server implementation dependent.
>- account.username = u"\u00FCtest"
>- account.password = u"\u00FCtest"
>- account.host = u"\u00FCtest"
>+ account.username = uw("test")
>+ account.password = uw("test")
>+ account.host = uw("test")
>
> if type(account) == Mail.AccountBase:
> account.port = 1
> account.connectionSecurity = "NONE"
>
> if type(account) == Mail.SMTPAccount:
>- account.fullName = u"\u00FCtest"
>+ account.fullName = uw("test")
> account.replyToAddress = Mail.EmailAddress(itsView=account.itsView)
>- account.replyToAddress.emailAddress = u"test at test.com"
>+ account.replyToAddress.emailAddress = "test at test.com"
>
> if __name__ == "__main__":
> unittest.main()
>
>
> Modified: trunk/chandler/parcels/osaf/pim/tests/TestNotes.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestNotes.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestNotes.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -11,6 +11,7 @@
> from osaf import pim
>
> from repository.util.Path import Path
>+from i18n.tests import uw
>
>
> class NotesTest(TestContentModel.ContentModelTestCase):
>@@ -22,11 +23,11 @@
> self.loadParcel("osaf.pim")
>
> def _verifyNote(note):
>- self.assertEqual(note.displayName, u"\u00FCsample note")
>+ self.assertEqual(note.displayName, uw("sample note"))
> self.assertEqual(note.getBasedAttributes('about'), ('displayName',))
>
>- self.assertEqual(note.body,
>- u"\u00FCmore elaborate sample note body")
>+ self.assertEqual(note.body,
>+ uw("more elaborate sample note body"))
>
> # Test the globals
> notesPath = Path('//parcels/osaf/pim')
>@@ -42,24 +43,20 @@
> self.assertEqual(noteItem.itsKind, pim.Note.getKind(view))
>
> # Literal properties
>- noteItem.displayName = u"\u00FCsample note"
>+ noteItem.displayName = uw("sample note")
>
>- # Lob property
>- lobType = noteItem.getAttributeAspect('body', 'type')
>+ noteItem.body = uw("more elaborate sample note body")
>
>- # when data is unicode, encoding defaults to utf-8
>- noteItem.body = lobType.makeValue(u"\u00FCmore elaborate sample note body")
>-
> _verifyNote(noteItem)
>
> self._reopenRepository()
> view = self.rep.view
> contentItemParent = view.findPath("//userdata")
>-
>+
> noteItem = contentItemParent.getItemChild("noteItem")
>-
>+
> _verifyNote(noteItem)
>-
>
>+
> if __name__ == "__main__":
> unittest.main()
>
>
> Modified:
> trunk/chandler/parcels/osaf/pim/tests/TestStampingTwice.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestStampingTwice.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestStampingTwice.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -27,7 +27,7 @@
> # @@@ Also make sure the default imap account is loaded, in order to
> # have a "me" EmailAddress
> view = self.rep.view
>-
>+
> # Get the stamp kinds
> taskMixin = TaskMixin.getKind(view)
> eventMixin = Calendar.CalendarEventMixin.getKind(view)
>
>
> Modified: trunk/chandler/parcels/osaf/pim/tests/TestTask.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/pim/tests/TestTask.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/pim/tests/TestTask.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -13,6 +13,7 @@
> import osaf.pim.tests.TestContentModel as TestContentModel
>
> from repository.util.Path import Path
>+from i18n.tests import uw
>
> class TaskTest(TestContentModel.ContentModelTestCase):
> """ Test Task """
>@@ -22,13 +23,13 @@
>
> def _verifyTask(task):
> self.assert_(task != None)
>- self.assertEqual(task.displayName, u"\u00FCtest headline")
>- self.assertEqual(task.getItemDisplayName(), u"\u00FCtest headline")
>+ self.assertEqual(task.displayName, uw("test headline"))
>+ self.assertEqual(task.getItemDisplayName(), uw("test headline"))
>
> self.assertEqual(task.importance, 'important')
> self.assertEqual(task.getAttributeValue('importance'), 'important')
>- self.assertEqual(task.about, u"\u00FCtest headline")
>-
>+ self.assertEqual(task.about, uw("test headline"))
>+
> self.loadParcel("osaf.pim.tasks")
>
> # Check that the globals got created by the parcel
>@@ -42,7 +43,7 @@
>
> # Construct A Sample Item
> taskItem = Task("TestTask", itsView=view)
>- taskItem.displayName = u"\u00FCtest headline"
>+ taskItem.displayName = uw("test headline")
> taskItem.importance = "important"
>
> self._reopenRepository()
>
>
> Modified: trunk/chandler/parcels/osaf/sharing/Sharing.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/Sharing.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/Sharing.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -83,8 +83,8 @@
> SharingConflictNotification(itsView=item.itsView,
> displayName="Conflict for attribute %s" % attribute,
> attribute=attribute,
>- local=str(getattr(item, attribute, None)),
>- remote=str(value),
>+ local=unicode(getattr(item, attribute, None)),
>+ remote=unicode(value),
> items=[item])
> """
>
>@@ -96,8 +96,8 @@
> {
> 'name' : item.getItemDisplayName(),
> 'attribute' : attribute,
>- 'local' : value,
>- 'remote' : getattr(item, attribute)
>+ 'local' : unicode(value),
>+ 'remote' : unicode(getattr(item, attribute))
> }
> )
> )
>@@ -596,7 +596,7 @@
> externalItemExists = self._externalItemExists(item)
>
> logger.debug("Examining for put: %s, version=%d",
>- item.getItemDisplayName().encode('ascii', 'replace'),
>+ item.getItemDisplayName().encode('utf8', 'replace'),
> item.getVersion())
>
> if not externalItemExists:
>@@ -613,17 +613,17 @@
> modifiedAttributes = changes[relatedItem.itsUUID]
> sharedAttributes = \
> self.share.getSharedAttributes(relatedItem)
>- logger.debug("Changes for %s: %s", relatedItem.getItemDisplayName().encode('ascii', 'replace'), modifiedAttributes)
>+ logger.debug("Changes for %s: %s", relatedItem.getItemDisplayName().encode('utf8', 'replace'), modifiedAttributes)
> for change in modifiedAttributes:
> if change in sharedAttributes:
>- logger.debug("A shared attribute (%s) changed for %s", change, relatedItem.getItemDisplayName().encode('ascii', 'replace'))
>+ logger.debug("A shared attribute (%s) changed for %s", change, relatedItem.getItemDisplayName().encode('utf8', 'replace'))
> needsUpdate = True
> result = 'modified'
> break
>
> if needsUpdate:
> logger.info("...putting '%s' %s (%d vs %d) (on server: %s)" % \
>- (item.getItemDisplayName().encode('ascii', 'replace'), item.itsUUID,
>+ (item.getItemDisplayName().encode('utf8', 'replace'), item.itsUUID,
> item.getVersion(), self.getMarker.getVersion(), externalItemExists))
>
> if updateCallback and updateCallback(msg="'%s'" %
>@@ -1779,7 +1779,7 @@
> raise
> except Exception, e:
> logger.exception("Failed to parse XML for item %s: '%s'" %
>- (itemPath, text.encode('ascii', 'replace')))
>+ (itemPath, text.encode('utf8', 'replace')))
> raise TransformationFailed(_(u"%(itemPath)s %(error)s (See chandler.log for text)") % \
> {'itemPath': itemPath, 'error': e})
>
>@@ -2196,16 +2196,16 @@
> SharingConflictNotification(itsView=item.itsView,
> displayName="Conflict for attribute %s" % attribute,
> attribute=attribute,
>- local=str(getattr(item, attribute, None)),
>- remote=str(value),
>+ local=unicode(getattr(item, attribute, None)),
>+ remote=unicode(value),
> items=[item])
>
> logger.warning("Sharing conflict: item '%s', attr '%s', "
> "local '%s', remote '%s'" %
>- (item.getItemDisplayName().encode('ascii', 'replace'),
>+ (item.getItemDisplayName().encode('utf8', 'replace'),
> attribute,
> getattr(item, attribute, None),
>- value))
>+ unicode(value).encode('utf8', 'replace')))
>
> if updateCallback:
> updateCallback(
>@@ -2226,9 +2226,9 @@
> SharingChangeNotification(itsView=item.itsView,
> displayName="Changed attribute %s" % attribute,
> attribute=attribute,
>- value=str(value),
>+ value=unicode(value),
> items=[item])
>- logger.info("Sharing change: item '%s', attr '%s', value '%s'" % (item.getItemDisplayName().encode('ascii', 'replace'), attribute, value))
>+ logger.info("Sharing change: item '%s', attr '%s', value '%s'" % (item.getItemDisplayName().encode('utf8', 'replace'), attribute, unicode(value).encode('utf8', 'replace')))
>
>
> except Exception, e:
>@@ -2892,7 +2892,7 @@
> values.append(value)
>
> logger.debug("for %s setting %s to %s" % \
>- (item.getItemDisplayName().encode('ascii',
>+ (item.getItemDisplayName().encode('utf8',
> 'replace'), attrName, values))
> setattr(item, attrName, values)
>
>
>
> Modified: trunk/chandler/parcels/osaf/sharing/__init__.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/__init__.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/__init__.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -212,7 +212,7 @@
> handle = conduit._getServerHandle()
> resource = handle.getResource(location)
>
>- logger.debug('Examining %s ...', location.encode('ascii', 'replace'))
>+ logger.debug('Examining %s ...', location.encode('utf8', 'replace'))
> exists = handle.blockUntil(resource.exists)
> if not exists:
> logger.debug("...doesn't exist")
>
>
> Modified:
> trunk/chandler/parcels/osaf/sharing/tests/TestFileSystemSharing.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/tests/TestFileSystemSharing.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/tests/TestFileSystemSharing.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -7,6 +7,7 @@
> from util import testcase
> from PyICU import ICUtzinfo
> from application import schema
>+from i18n.tests import uw
>
> logger = logging.getLogger(__name__)
>
>@@ -29,13 +30,13 @@
>
> sandbox = view.findPath("//sandbox")
> coll = pim.ListCollection("testCollection", sandbox,
>- displayName=u"\u00FCTest Collection")
>+ displayName=uw("Test Collection"))
>
> names = [
>- (u"\u00FCnicode Test", u"\u00FCnicode Test", u"unicodetest at example.com"),
>- (u"Morgen", u"Sagen", u"morgen at example.com"),
>- (u"Ted", u"Leung", u"ted at example.com"),
>- (u"Andi", u"Vajda", u"andi at example.com"),
>+ (uw("unicode Test"), uw("unicode Test"), "unicodetest at example.com"),
>+ ("Morgen", "Sagen", "morgen at example.com"),
>+ ("Ted", "Leung", "ted at example.com"),
>+ ("Andi", "Vajda", "andi at example.com"),
> ]
>
> contacts = []
>@@ -50,20 +51,19 @@
> contacts.append(c)
>
> events = [
>- u"breakfast",
>- u"lunch",
>- u"dinner",
>- u"meeting",
>- u"movie",
>- u'\u8fd1\u85e4\u6df3\u4e5f\u306e\u65b0\u30cd\u30c3\u30c8\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u8ad6',
>+ uw("breakfast"),
>+ uw("lunch"),
>+ uw("dinner"),
>+ uw("meeting"),
>+ uw("movie"),
> ]
>
> self.uuids = {}
>
> tzinfo = ICUtzinfo.default
>- for i in xrange(6):
>+ for i in xrange(5):
> c = pim.CalendarEvent(itsParent=sandbox)
>- c.displayName = events[i % 6]
>+ c.displayName = events[i % 5]
> c.organizer = contacts[0]
> c.participants = [contacts[1], contacts[2]]
> c.startTime=datetime.datetime(2005, 10, 31, 12, 0, 0, 0, tzinfo)
>@@ -77,7 +77,7 @@
> sandbox0 = view0.findPath("//sandbox")
> coll0 = sandbox0.findPath("testCollection")
> conduit = sharing.FileSystemConduit("conduit", itsView=view0,
>- sharePath=".", shareName=u"\u00FCexportedCollection")
>+ sharePath=".", shareName=uw("exportedCollection"))
> format = sharing.CloudXMLFormat("format", itsView=view0)
> self.share0 = sharing.Share("share", itsView=view0,
> contents=coll0, conduit=conduit, format=format)
>@@ -87,7 +87,7 @@
>
> view1 = self.views[1]
> conduit = sharing.FileSystemConduit("conduit", itsView=view1,
>- sharePath=".", shareName=u"\u00FCexportedCollection")
>+ sharePath=".", shareName=uw("exportedCollection"))
> format = sharing.CloudXMLFormat("format", itsView=view1)
> self.share1 = sharing.Share("share", itsView=view1,
> conduit=conduit, format=format)
>@@ -140,12 +140,12 @@
> coll1 = view1.findUUID(coll0.itsUUID)
>
> for item in coll0:
>- if item.displayName == u"meeting":
>+ if item.displayName == uw("meeting"):
> uuid = item.itsUUID
> break
>
> item0 = view0.findUUID(uuid)
>- item0.displayName = u"\u00FCmeeting rescheduled"
>+ item0.displayName = uw("meeting rescheduled")
> oldStart = item0.startTime
>
> tzinfo = ICUtzinfo.default
>@@ -160,15 +160,15 @@
> sharing.sync(coll0)
> time.sleep(1)
>
>- self.assertEqual(item0.displayName, u"\u00FCmeeting rescheduled",
>- u"displayName is %s" % (item0.displayName))
>- self.assertEqual(item1.displayName, u"\u00FCmeeting rescheduled",
>- u"displayName is %s" % (item1.displayName))
>+ self.assertEqual(item0.displayName, uw("meeting rescheduled"),
>+ "displayName is %s" % (item0.displayName.encode("utf8")))
>+ self.assertEqual(item1.displayName, uw("meeting rescheduled"),
>+ "displayName is %s" % (item1.displayName.encode("utf8")))
>
> self.assertEqual(item0.startTime, newStart,
>- u"startTime is %s" % (item0.startTime))
>+ "startTime is %s" % (item0.startTime))
> self.assertEqual(item1.startTime, newStart,
>- u"startTime is %s" % (item1.startTime))
>+ "startTime is %s" % (item1.startTime))
>
> def Remove(self):
>
>@@ -180,7 +180,7 @@
> coll1 = view1.findUUID(coll0.itsUUID)
>
> for item in coll0:
>- if item.displayName == u"\u00FCmeeting rescheduled":
>+ if item.displayName == uw("meeting rescheduled"):
> uuid = item.itsUUID
> break
>
>
>
> Modified:
> trunk/chandler/parcels/osaf/sharing/tests/TestICalendar.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/tests/TestICalendar.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/tests/TestICalendar.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -19,6 +19,7 @@
> from PyICU import ICUtzinfo
> from dateutil import tz
> from osaf.pim.calendar.Recurrence import RecurrenceRule, RecurrenceRuleSet
>+from i18n.tests import uw
>
> class ICalendarTestCase(unittest.TestCase):
>
>@@ -112,7 +113,7 @@
> format = self.Import(self.repo.view, u'AllDay.ics')
> collection = self.share.contents
> schema.ns('osaf.pim', self.repo.view).mine.addSource(collection)
>-
>+
> start = datetime.datetime(2005,1,1, tzinfo=ICUtzinfo.floating)
> end = start + datetime.timedelta(2)
>
>@@ -123,7 +124,7 @@
> """Tests itemsToVObject, which converts Chandler items to vobject."""
> event = Calendar.CalendarEvent(itsView = self.repo.view)
> event.anyTime = False
>- event.displayName = u"\u00FCtest"
>+ event.displayName = uw("test")
> event.startTime = datetime.datetime(2010, 1, 1, 10,
> tzinfo=ICUtzinfo.default)
> event.endTime = datetime.datetime(2010, 1, 1, 11,
>@@ -131,7 +132,7 @@
>
> cal = ICalendar.itemsToVObject(self.repo.view, [event])
>
>- self.assert_(cal.vevent.summary.value == u"\u00FCtest",
>+ self.assert_(cal.vevent.summary.value == uw("test"),
> u"summary not set properly, summary is %s"
> % cal.vevent.summary.value)
>
>@@ -141,7 +142,7 @@
> % cal.vevent.summary.value)
>
> event = Calendar.CalendarEvent(itsView = self.repo.view)
>- event.displayName = u"\u00FCtest2"
>+ event.displayName = uw("test2")
> event.startTime = datetime.datetime(2010, 1, 1,
> tzinfo=ICUtzinfo.floating)
> event.allDay = True
>@@ -152,7 +153,7 @@
> u"dtstart for allDay event not set properly, dtstart is %s"
> % cal.vevent.summary.value)
> # test bug 3509, all day event duration is off by one
>-
>+
> def writeICalendarUnicodeBug3338(self):
> event = Calendar.CalendarEvent(itsView = self.repo.view)
> event.displayName = u"unicode \u0633\u0644\u0627\u0645"
>@@ -203,7 +204,7 @@
> format = self.Import(self.repo.view, u'UnusualTzid.ics')
> event = Calendar.findUID(self.repo.view, '42583280-8164-11da-c77c-0011246e17f0')
> self.assertEqual(event.startTime.tzinfo, ICUtzinfo.getInstance('US/Mountain'))
>-
>+
> def importReminders(self):
> format = self.Import(self.repo.view, u'RecurrenceWithAlarm.ics')
> future = Calendar.findUID(self.repo.view, 'RecurringAlarmFuture')
>@@ -212,19 +213,19 @@
> self.assertEqual(reminder.delta, datetime.timedelta(minutes=-5))
> second = future.getNextOccurrence()
> self.assert_(reminder in second.reminders)
>-
>+
> past = Calendar.findUID(self.repo.view, 'RecurringAlarmPast')
> reminder = past.expiredReminders.first()
> self.assertEqual(reminder.delta, datetime.timedelta(hours=-1))
> second = past.getNextOccurrence()
> self.assert_(reminder in second.expiredReminders)
>-
>+
> def exportRecurrence(self):
> eastern = ICUtzinfo.getInstance("US/Eastern")
> start = datetime.datetime(2005,2,1, tzinfo = eastern)
> vevent = vobject.icalendar.RecurringComponent(name='VEVENT')
> vevent.behavior = vobject.icalendar.VEvent
>-
>+
> vevent.add('dtstart').value = start
>
> # not creating a RuleSetItem, although it would be required for an item
>@@ -232,37 +233,37 @@
> ruleItem.freq = 'daily'
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.repo.view)
> ruleSetItem.addRule(ruleItem)
>-
>+
> vevent.rruleset = ruleSetItem.createDateUtilFromRule(start)
> self.assertEqual(vevent.rrule.value, 'FREQ=DAILY')
>-
>-
>+
>+
> event = Calendar.CalendarEvent(itsView = self.repo.view)
> event.anyTime = False
>- event.displayName = u"\u00FCblah"
>+ event.displayName = uw("blah")
> event.startTime = start
> event.endTime = datetime.datetime(2005,3,1,1, tzinfo = eastern)
>-
>+
> ruleItem = RecurrenceRule(None, itsView=self.repo.view)
> ruleItem.until = datetime.datetime(2005,3,1, tzinfo = eastern)
> ruleSetItem = RecurrenceRuleSet(None, itsView=self.repo.view)
> ruleSetItem.addRule(ruleItem)
> event.rruleset = ruleSetItem
>-
>+
> vcalendar = ICalendar.itemsToVObject(self.repo.view, [event])
>-
>+
> self.assertEqual(vcalendar.vevent.dtstart.serialize(),
> 'DTSTART;TZID=US/Eastern:20050201T000000\r\n')
> vcalendar.vevent = vcalendar.vevent.transformFromNative()
> self.assertEqual(vcalendar.vevent.rrule.serialize(),
> 'RRULE:FREQ=WEEKLY;UNTIL=20050302T045900Z\r\n')
>-
>+
> # move the second occurrence one day later
> nextEvent = event.getNextOccurrence()
> nextEvent.changeThis('startTime',
>- datetime.datetime(2005,2,9,
>+ datetime.datetime(2005,2,9,
> tzinfo=ICUtzinfo.floating))
>-
>+
> nextEvent.getNextOccurrence().deleteThis()
>
> vcalendar = ICalendar.itemsToVObject(self.repo.view, [event])
>@@ -284,13 +285,13 @@
> # test import/export unicode
>
> class TimeZoneTestCase(unittest.TestCase):
>-
>+
> def getICalTzinfo(self, lines):
> fileobj = cStringIO.StringIO("\r\n".join(lines))
> parsed = tz.tzical(fileobj)
>
> return parsed.get()
>-
>+
> def runConversionTest(self, expectedZone, icalZone):
> dt = datetime.datetime(2004, 10, 11, 13, 22, 21, tzinfo=icalZone)
> convertedZone = ICalendar.convertToICUtzinfo(dt).tzinfo
>@@ -301,7 +302,7 @@
> convertedZone = ICalendar.convertToICUtzinfo(dt).tzinfo
> self.failUnless(isinstance(convertedZone, ICUtzinfo))
> self.failUnlessEqual(expectedZone, convertedZone)
>-
>+
> def testVenezuela(self):
> zone = self.getICalTzinfo([
> "BEGIN:VTIMEZONE",
>@@ -320,13 +321,13 @@
> "TZNAME:VET",
> "END:STANDARD",
> "END:VTIMEZONE"])
>-
>+
> self.runConversionTest(
> ICUtzinfo.getInstance("America/Caracas"),
> zone)
>-
>+
> def testAustralia(self):
>-
>+
> zone = self.getICalTzinfo([
> "BEGIN:VTIMEZONE",
> "TZID:Australia/Sydney",
>@@ -344,11 +345,11 @@
> "TZNAME:EST",
> "END:DAYLIGHT",
> "END:VTIMEZONE"])
>-
>+
> self.runConversionTest(
> ICUtzinfo.getInstance("Australia/Sydney"),
> zone)
>-
>+
> def testFrance(self):
>
> zone = self.getICalTzinfo([
>@@ -372,7 +373,7 @@
> self.runConversionTest(
> ICUtzinfo.getInstance("Europe/Paris"),
> zone)
>-
>+
> def testUS(self):
> zone = self.getICalTzinfo([
> "BEGIN:VTIMEZONE",
>
>
> Modified:
> trunk/chandler/parcels/osaf/sharing/tests/TestInMemoryConduit.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/tests/TestInMemoryConduit.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/tests/TestInMemoryConduit.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -7,6 +7,7 @@
> from util import testcase
> from PyICU import ICUtzinfo
> from application import schema
>+from i18n.tests import uw
>
> logger = logging.getLogger(__name__)
>
>@@ -29,10 +30,10 @@
>
> sandbox = view.findPath("//sandbox")
> coll = pim.ListCollection("testCollection", sandbox,
>- displayName=u"\u00FCTest Collection")
>+ displayName=uw("Test Collection"))
>
> names = [
>- (u"\u00FCnicode test", u"\u00FCnicode test", u"unicodetest at example.com"),
>+ (uw("unicode test"), uw("unicode test"), u"unicodetest at example.com"),
> (u"Morgen", u"Sagen", u"morgen at example.com"),
> (u"Ted", u"Leung", u"ted at example.com"),
> (u"Andi", u"Vajda", u"andi at example.com"),
>@@ -78,7 +79,7 @@
> sandbox0 = view0.findPath("//sandbox")
> coll0 = sandbox0.findPath("testCollection")
> conduit = sharing.InMemoryConduit("conduit", itsView=view0,
>- shareName=u"\u00FCexportedCollection")
>+ shareName=uw("exportedCollection"))
> format = sharing.CloudXMLFormat("format", itsView=view0)
> self.share0 = sharing.Share("share", itsView=view0,
> contents=coll0, conduit=conduit, format=format)
>@@ -88,7 +89,7 @@
>
> view1 = self.views[1]
> conduit = sharing.InMemoryConduit("conduit", itsView=view1,
>- shareName=u"\u00FCexportedCollection")
>+ shareName=uw("exportedCollection"))
> format = sharing.CloudXMLFormat("format", itsView=view1)
> self.share1 = sharing.Share("share", itsView=view1,
> conduit=conduit, format=format)
>@@ -146,7 +147,7 @@
> break
>
> item0 = view0.findUUID(uuid)
>- item0.displayName = u"\u00FCmeeting rescheduled"
>+ item0.displayName = uw("meeting rescheduled")
> oldStart = item0.startTime
>
> tzinfo = ICUtzinfo.getDefault()
>@@ -158,9 +159,9 @@
> sharing.sync(coll1)
> sharing.sync(coll0)
>
>- self.assertEqual(item0.displayName, u"\u00FCmeeting rescheduled",
>+ self.assertEqual(item0.displayName, uw("meeting rescheduled"),
> u"displayName is %s" % (item0.displayName))
>- self.assertEqual(item1.displayName, u"\u00FCmeeting rescheduled",
>+ self.assertEqual(item1.displayName, uw("meeting rescheduled"),
> u"displayName is %s" % (item1.displayName))
>
> self.assertEqual(item0.startTime, newStart,
>@@ -178,7 +179,7 @@
> coll1 = view1.findUUID(coll0.itsUUID)
>
> for item in coll0:
>- if item.displayName == u"\u00FCmeeting rescheduled":
>+ if item.displayName == uw("meeting rescheduled"):
> uuid = item.itsUUID
> break
>
>
>
> Modified:
> trunk/chandler/parcels/osaf/sharing/tests/TestModifiableAttributes.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/tests/TestModifiableAttributes.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/tests/TestModifiableAttributes.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -2,6 +2,7 @@
> from osaf import pim, sharing
> from application import schema
> from util import testcase
>+from i18n.tests import uw
>
> class TestModifiableAttributes(testcase.NRVTestCase):
>
>@@ -20,7 +21,7 @@
>
> # Add the subject to a read-only share:
>
>- share_ro = sharing.Share(itsView=view, displayName=u"\u00FCshare_ro")
>+ share_ro = sharing.Share(itsView=view, displayName=uw("share_ro"))
> share_ro.mode = 'get'
>
> e1.sharedIn.append(share_ro)
>
>
> Modified:
> trunk/chandler/parcels/osaf/sharing/tests/TestViewMerging.py
> (10797 => 10798)
>
>--- trunk/chandler/parcels/osaf/sharing/tests/TestViewMerging.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/parcels/osaf/sharing/tests/TestViewMerging.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -7,6 +7,7 @@
> from util import testcase
> from PyICU import ICUtzinfo
> from application import schema
>+from i18n.tests import uw
>
> logger = logging.getLogger(__name__)
>
>@@ -51,10 +52,10 @@
>
> sandbox = view.findPath("//sandbox")
> coll = pim.ListCollection("testCollection", sandbox,
>- displayName=u"\u00FCTest Collection")
>+ displayName=uw("Test Collection"))
>
> names = [
>- (u"\u00FCnicode Test", u"\u00FCnicode Test", u"unicodetest at example.com"),
>+ (uw("unicode Test"), uw("unicode Test"), u"unicodetest at example.com"),
> (u"Morgen", u"Sagen", u"morgen at example.com"),
> (u"Ted", u"Leung", u"ted at example.com"),
> (u"Andi", u"Vajda", u"andi at example.com"),
>@@ -92,7 +93,7 @@
> c.startTime=datetime.datetime(2005, 10, 31, 12, 0, 0, 0, tzinfo)
> c.duration=datetime.timedelta(minutes=60)
> c.anyTime=False
>- c.body = u"\u00FCnicode test"
>+ c.body = uw("unicode test")
> self.uuids[c.itsUUID] = c.displayName
> coll.add(c)
>
>@@ -105,14 +106,14 @@
> self.share0 = sharing.Share(itsView=view0,
> contents=coll0,
> conduit=sharing.InMemoryConduit(itsView=view0,
>- shareName=u"\u00FCviewmerging"),
>+ shareName=uw("viewmerging")),
> format=sharing.CalDAVFormat(itsView=view0)
> )
>
> subShare = sharing.Share(itsView=view0,
> contents=coll0,
> conduit=sharing.InMemoryConduit(itsView=view0,
>- shareName=u"\u00FCviewmerging/.chandler"),
>+ shareName=uw("viewmerging/.chandler")),
> format=sharing.CloudXMLFormat(itsView=view0)
> )
> self.share0.follows = subShare
>@@ -129,13 +130,13 @@
>
> self.share1 = sharing.Share(itsView=view1,
> conduit=sharing.InMemoryConduit(itsView=view1,
>- shareName=u"\u00FCviewmerging"),
>+ shareName=uw("viewmerging")),
> format=sharing.CalDAVFormat(itsView=view1)
> )
>
> subShare = sharing.Share(itsView=view1,
> conduit=sharing.InMemoryConduit(itsView=view1,
>- shareName=u"\u00FCviewmerging/.chandler"),
>+ shareName=uw("viewmerging/.chandler")),
> format=sharing.CloudXMLFormat(itsView=view1)
> )
> self.share1.follows = subShare
>@@ -214,7 +215,7 @@
>
> # Make non-overlapping changes to the item
> item0 = view0.findUUID(uuid)
>- item0.displayName = u"\u00FCmeeting rescheduled"
>+ item0.displayName = uw("meeting rescheduled")
> oldStart = item0.startTime
>
> tzinfo = ICUtzinfo.getDefault()
>@@ -247,9 +248,9 @@
> {'added' : 0, 'modified' : 0, 'removed' : 0})),
> "Sync operation mismatch")
>
>- self.assertEqual(item0.displayName, u"\u00FCmeeting rescheduled",
>+ self.assertEqual(item0.displayName, uw("meeting rescheduled"),
> u"displayName is %s" % (item0.displayName))
>- self.assertEqual(item1.displayName, u"\u00FCmeeting rescheduled",
>+ self.assertEqual(item1.displayName, uw("meeting rescheduled"),
> u"displayName is %s" % (item1.displayName))
>
> self.assertEqual(item0.startTime, newStart,
>@@ -297,8 +298,8 @@
> self.assertEqual(item1.startTime, newStart0,
> u"startTime is %s" % (item1.startTime))
>
>- item0.body = u"\u00FCview0 change"
>- item1.body = u"\u00FCview1 change"
>+ item0.body = uw("view0 change")
>+ item1.body = uw("view1 change")
>
> stats = sharing.sync(coll0)
> printStats(view0, stats)
>@@ -326,9 +327,9 @@
> "Sync operation mismatch")
>
> # Since we sync'd coll0 first, its change wins out over coll1
>- self.assertEqual(item0.body, u"\u00FCview0 change",
>+ self.assertEqual(item0.body, uw("view0 change"),
> u"item0 body is %s" % item0.body)
>- self.assertEqual(item1.body, u"\u00FCview0 change",
>+ self.assertEqual(item1.body, uw("view0 change"),
> u"item1 body is %s" % item1.body)
>
>
>@@ -343,7 +344,7 @@
> coll1 = view1.findUUID(coll0.itsUUID)
>
> for item in coll0:
>- if item.displayName == u"\u00FCmeeting rescheduled":
>+ if item.displayName == uw("meeting rescheduled"):
> uuid = item.itsUUID
> break
>
>
>
> Modified: trunk/chandler/tools/QALogger.py (10797 => 10798)
>
>--- trunk/chandler/tools/QALogger.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QALogger.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -100,17 +100,22 @@
> self.nbVerif = 0
> self.failureList = []
> self.passedList = []
>-
>+
> def Print(self,string):
> ''' Printing method '''
>+
>+ if isinstance(string, unicode):
>+ string = string.encode(sys.getfilesystemencoding())
>+
> if self.inTerminal:
>- print "%s" %string
>+ print "%s" % string
> else:
> self.File.write(string+'\n')
> self.File.flush()
>
> def PrintTBOX(self, elapsed, level=None):
> description = string.join(string.split(self.mainDescription, " "), "_")
>+
> if level == "Testcase":
> testcaseDesc = string.join(string.split(self.subTestcaseDesc, " "), "_")
> description = "%s.%s" %(description, testcaseDesc)
>@@ -123,7 +128,7 @@
> elapsed_secs = elapsed.seconds + elapsed.microseconds / 1000000.0
> self.Print("OSAF_QA: %s | %s | %s" %(description, version.revision, elapsed_secs))
> print("OSAF_QA: %s | %s | %s" %(description, version.revision, elapsed_secs))
>-
>+
> def SuspendProfiling(self):
> """
> Suspend profiling of code between Start()/Stop() calls
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestCalView.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestCalView.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestCalView.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,5 +1,6 @@
> import tools.QAUITestAppLib as QAUITestAppLib
> import osaf.framework.scripting as scripting
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestCalView.log"
>@@ -17,12 +18,12 @@
> # double click one more time => edit the title
> #testView.DoubleClickInCalView()
> # type a new title and return
>- QAUITestAppLib.scripting.User.emulate_typing("Writing tests")
>+ QAUITestAppLib.scripting.User.emulate_typing(uw("Writing tests"))
> QAUITestAppLib.scripting.User.emulate_return()
>
> # verification
> # check the detail view of the created event
>- ev.Check_DetailView({"displayName":"Writing tests"})
>+ ev.Check_DetailView({"displayName": uw("Writing tests")})
>
> finally:
> # cleaning
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestCreateAccounts.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestCreateAccounts.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestCreateAccounts.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestCreateAccounts.log"
>@@ -8,34 +9,42 @@
> # creation
> logger.Start("Account Preferences Dialog")
> ap = QAUITestAppLib.UITestAccounts(logger)
>-
>+
>+ pSMTP = uw("Personal SMTP")
>+ pIMAP = uw("Personal IMAP")
>+ pPOP = uw("Personal POP")
>+ pWEBDAV = uw("Personal WEBDAV")
>+ pEMAIL = "demo1 at osafoundation.org"
>+ pNAME = uw("Demo One")
>+
> # action
> ap.Open() # first, open the accounts dialog window
>-
>+
> ap.CreateAccount("SMTP") # create a new SMTP account
>- ap.TypeValue("displayName", "Personal SMTP") # type the following values into their apporpriate fields
>+ ap.TypeValue("displayName", pSMTP)
> ap.TypeValue("host","smtp.osafoundation.org")
> ap.SelectValue("security", 'TLS') # select the TLS radio button
> ap.ToggleValue("authentication", True) # turn on the authentication checkbox
> ap.TypeValue("port", '587')
>+ ap.TypeValue("email",pEMAIL)
> ap.TypeValue('username', 'demo1')
> ap.TypeValue('password', 'ad3leib5')
>-
>+
> ap.CreateAccount("IMAP")
>- ap.TypeValue("displayName", "Personal IMAP")
>- ap.TypeValue("email", "demo1 at osaofundation.org")
>- ap.TypeValue("name","Demo One")
>+ ap.TypeValue("displayName", pIMAP)
>+ ap.TypeValue("email", pEMAIL)
>+ ap.TypeValue("name", pNAME)
> ap.TypeValue("host", "imap.osafoundation.org")
> ap.TypeValue("username", "demo1")
> ap.TypeValue("password", "ad3leib5")
> ap.SelectValue("security", "SSL")
> ap.ToggleValue("default", True)
>- ap.SelectValue("server", "Personal SMTP")
>-
>+ ap.SelectValue("server", pSMTP)
>+
> ap.CreateAccount("POP")
>- ap.TypeValue("displayName", "Personal POP")
>- ap.TypeValue("email", "demo1 at osafoundation.org")
>- ap.TypeValue("name", "Demo One")
>+ ap.TypeValue("displayName", pPOP)
>+ ap.TypeValue("email", pEMAIL)
>+ ap.TypeValue("name", pNAME)
> ap.TypeValue("host", "pop.osafoundation.org")
> ap.TypeValue("username", "demo1")
> ap.TypeValue("password", "ad3leib5")
>@@ -43,10 +52,10 @@
> ap.TypeValue("port", "143")
> ap.ToggleValue("leave", True)
> ap.ToggleValue("default", True)
>- ap.SelectValue("server", "Personal SMTP")
>-
>+ ap.SelectValue("server", pSMTP)
>+
> ap.CreateAccount("WebDAV")
>- ap.TypeValue("displayName", "Personal WebDAV")
>+ ap.TypeValue("displayName", pWEBDAV)
> ap.TypeValue("host", "qacosmo.osafoundation.org")
> ap.TypeValue("path", "home/demo1")
> ap.TypeValue("username", "demo1")
>@@ -54,15 +63,15 @@
> ap.TypeValue("port", "8080")
> ap.ToggleValue("ssl", False)
> ap.ToggleValue("default", True)
>-
>+
> ap.Ok()
> logger.Stop()
>-
>+
> # verification
>- ap.VerifyValues("SMTP", "Personal SMTP", displayName = "Personal SMTP", host= "smtp.osafoundation.org", connectionSecurity = "TLS", useAuth = True, port = 587, username = 'demo1', password = 'ad3leib5' )
>- ap.VerifyValues("IMAP", "Personal IMAP", displayName = "Personal IMAP", host = "imap.osafoundation.org", connectionSecurity = "SSL", username = "demo1", password = "ad3leib5")
>- ap.VerifyValues("POP", "Personal POP", displayName = "Personal POP", host = "pop.osafoundation.org", connectionSecurity = "SSL", username = "demo1", password = "ad3leib5")
>- ap.VerifyValues("WebDAV", "Personal WebDAV", displayName = "Personal WebDAV", host = "qacosmo.osafoundation.org", username = "demo1", password="ad3leib5", port=8080)
>+ ap.VerifyValues("SMTP", pSMTP, displayName = pSMTP, host= "smtp.osafoundation.org", connectionSecurity = "TLS", useAuth = True, port = 587, username = 'demo1', password = 'ad3leib5' )
>+ ap.VerifyValues("IMAP", pIMAP, displayName = pIMAP, host = "imap.osafoundation.org", connectionSecurity = "SSL", username = "demo1", password = "ad3leib5")
>+ ap.VerifyValues("POP", pPOP, displayName = pPOP, host = "pop.osafoundation.org", connectionSecurity = "SSL", username = "demo1", password = "ad3leib5")
>+ ap.VerifyValues("WebDAV", pWEBDAV, displayName = pWEBDAV, host = "qacosmo.osafoundation.org", username = "demo1", password="ad3leib5", port=8080)
>
> finally:
> # cleaning
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestDates.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestDates.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestDates.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>+from i18n.tests import uw
>
> #initialization
> fileName = "TestDates.log"
>@@ -36,16 +37,16 @@
> testItems = dateValues[locale]
>
> for test in testItems:
>- s = '%s %s :: %s %s :: %s' % test
>+ s = uw('%s %s :: %s %s :: %s' % test)
>
>- event.SetAttr(displayName="Test",
>+ event.SetAttr(displayName=uw("Test"),
> startDate=test[START_DATE],
> startTime=test[START_TIME],
> body=s,
> timeZone=test[TIMEZONE]
> )
>
>- event.Check_DetailView({"displayName": "Test",
>+ event.Check_DetailView({"displayName": uw("Test")),
> "startDate": test[START_DATE],
> "endDate": test[END_DATE],
> "startTime": test[START_TIME],
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestDeleteCollection.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestDeleteCollection.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestDeleteCollection.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,5 +1,6 @@
> import tools.QAUITestAppLib as QAUITestAppLib
> import osaf.framework.scripting as scripting
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestDeleteCollection.log"
>@@ -8,13 +9,12 @@
> try:
> # creation
> col = QAUITestAppLib.UITestItem("Collection", logger)
>- col.SetDisplayName("ToBeDeleted")
>-
>+ col.SetDisplayName(uw("ToBeDeleted"))
> # action
> App_ns = scripting.app_ns()
> sb = App_ns.sidebar
> # move focus from collection name text to collection
>- scripting.User.emulate_sidebarClick(sb, 'ToBeDeleted')
>+ scripting.User.emulate_sidebarClick(sb, uw("ToBeDeleted"))
> col.DeleteCollection()
>
> # verification
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestEditModeOnEnter.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestEditModeOnEnter.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestEditModeOnEnter.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -4,6 +4,7 @@
>
> import tools.QAUITestAppLib as QAUITestAppLib
> import osaf.framework.scripting as scripting
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestEditModeOnEnter.log"
>@@ -13,39 +14,40 @@
> # test edit on enter for collection names
> # creation
> testCollection = QAUITestAppLib.UITestItem("Collection", logger)
>-
>+
> # action 1 test collection name
> # use enter to shift to edit mode
> testCollection.SelectItem()
> QAUITestAppLib.scripting.User.emulate_return()
>- QAUITestAppLib.scripting.User.emulate_typing("NoLongerUntitled")
>+
>+ QAUITestAppLib.scripting.User.emulate_typing(uw("NoLongerUntitled"))
> # use enter to leave edit mode
> #except it doesn't work, focus somewhere else for the time being
> #QAUITestAppLib.scripting.User.emulate_return()
> testCollection.FocusInDetailView()
>-
>+
> #verification 1
>- testCollection.Check_CollectionExistence("NoLongerUntitled")
>-
>+ testCollection.Check_CollectionExistence(uw("NoLongerUntitled"))
>+
> # switch to summary view
> QAUITestAppLib.UITestView(logger).SwitchToAllView()
>-
>+
> # test edit on enter for summary view rows
> # creation 2
> testEvent = QAUITestAppLib.UITestItem("Event", logger)
>-
>+
> # action 2
> testEvent.SelectItem()
> QAUITestAppLib.scripting.User.emulate_return()
> #QAUITestAppLib.scripting.User.emulate_return() #until bug 5744 resolved 2 returns needed
>- QAUITestAppLib.scripting.User.emulate_typing("Your title here")
>+ QAUITestAppLib.scripting.User.emulate_typing(uw("Your title here"))
> #QAUITestAppLib.scripting.User.emulate_return()#emulate_return doesn't work here either at svn r9900
>- testCollection.FocusInDetailView()
>-
>+ testCollection.FocusInDetailView()
>+
> # verification 2
> # check the detail view of the created event
>- testEvent.Check_DetailView({"displayName":"Your title here"})
>+ testEvent.Check_DetailView({"displayName": uw("Your title here")})
>
> finally:
> # cleaning
>- logger.Close()
>\ No newline at end of file
>+ logger.Close()
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestEventStacking.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestEventStacking.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestEventStacking.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -4,6 +4,7 @@
> import tools.QAUITestAppLib as QAUITestAppLib
> from time import localtime
> from time import strftime
>+from i18n.tests import uw
>
> App_ns = app_ns()
> today = strftime('%m/%d/%y',localtime())
>@@ -16,27 +17,27 @@
> #Make sure we are in calendar view
> view = QAUITestAppLib.UITestView(logger)
> view.SwitchToCalView()
>-
>+
> #Create a collection and select it
> collection = QAUITestAppLib.UITestItem("Collection", logger)
>- collection.SetDisplayName("stacked")
>+ collection.SetDisplayName(uw("stacked"))
> sidebar = App_ns.sidebar
>- QAUITestAppLib.scripting.User.emulate_sidebarClick(sidebar, "stacked")
>-
>+ QAUITestAppLib.scripting.User.emulate_sidebarClick(sidebar, uw("stacked"))
>+
> #make sure we are on current week
> view.GoToToday()
>-
>+
> # creation
> for i in range(10):
>- eventName = 'Stacked Event %d' % i
>+ eventName = uw("Stacked Event %d" %i)
> event = QAUITestAppLib.UITestItem("Event", logger)
>-
>+
> #action
>- event.SetAttr(displayName=eventName, startDate=today, startTime="12:00 PM", body="Stacked event test")
>-
>+ event.SetAttr(displayName=eventName, location=uw("location"),startDate=today, startTime="12:00 PM", body=uw("Stacked event test"))
>+
> #verification
>- event.Check_DetailView({"displayName":eventName,"startDate":today,"endDate":today,"startTime":"12:00 PM","body":"Stacked event test"})
>-
>+ event.Check_DetailView({"displayName":eventName,"location":uw("location"),"startDate":today,"endDate":today,"startTime":"12:00 PM","body":uw("Stacked event test")})
>+
> finally:
> #cleaning
>- logger.Close()
>\ No newline at end of file
>+ logger.Close()
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,6 +1,7 @@
> import tools.QAUITestAppLib as QAUITestAppLib
> import flickr
> import socket
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestFlickr.log"
>@@ -25,7 +26,7 @@
> # get a collection of photos from the oscon2005 tag
> fc = flickr.PhotoCollection(itsView = repView)
> fc.tag = flickr.Tag.getTag(repView, "oscon2005")
>- fc.displayName = "oscon2005"
>+ fc.displayName = uw("oscon2005")
>
> try:
> fc.fillCollectionFromFlickr(repView)
>@@ -53,7 +54,7 @@
> User.idle()
>
> # check results
>- col = sidebarCollectionNamed("oscon2005")
>+ col = sidebarCollectionNamed(uw("oscon2005"))
> if not col:
> logger.ReportFailure("Flickr Collection wasn't created")
> if col and len(col) != 10:
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestImportOverwrite.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestImportOverwrite.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestImportOverwrite.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -4,6 +4,7 @@
> import os, wx , sys
> import osaf.pim.calendar.Calendar as Calendar
> from osaf.pim import ListCollection
>+from i18n.tests import uw
>
> App_ns = app_ns()
> appView = app_ns().itsView
>@@ -17,7 +18,7 @@
> event = QAUITestAppLib.UITestItem("Event", logger)
> event_UUID = event.item.itsUUID
> #write some stuff in the event to make it unique
>- event.SetAttr(displayName="Original Event", startDate="01/01/2001", startTime="12:00 AM", body="This is the original event")
>+ event.SetAttr(displayName=uw("Original Event"), startDate="01/01/2001", startTime="12:00 AM", body=uw("This is the original event"))
> logger.ReportPass("Create Event to Export")
>
> #export the event
>@@ -39,9 +40,9 @@
> share.put()
> wx.GetApp().Yield()
> logger.ReportPass("Exporting event")
>-
>+
> #change the event after exporting
>- event.SetAttr(displayName="Changed Event", body="This event has been changed")
>+ event.SetAttr(displayName=uw("Changed Event"), body=uw("This event has been changed"))
> logger.ReportPass("modifing event")
>
> #import the original event
>@@ -54,12 +55,13 @@
> #check if changed attributes have reverted to original values
> #find imported event by UUID
> found = App_ns.view.findUUID(event_UUID)
>- if found.body == 'This is the original event' and found.displayName == 'Original Event':
>+ if found.body == uw('This is the original event') and \
>+ found.displayName == uw('Original Event'):
> logger.ReportPass("Event overwriten")
> else:
> logger.ReportFailure('Event not overwriten')
>-
>-
>+
>+
> finally:
> #report results
> logger.SetChecked(True)
>@@ -67,4 +69,4 @@
> logger.Report()
> # cleanup
> logger.Close()
>-
>+
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestImporting.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestImporting.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestImporting.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -15,7 +15,7 @@
> # Upcast path to unicode since Sharing requires a unicode path
> path = unicode(path, sys.getfilesystemencoding())
> share = Sharing.OneTimeFileSystemShare(path, u'importTest.ics', ICalendar.ICalendarFormat, itsView=App_ns.itsView)
>-
>+
> logger.Start("Import Large Calendar")
> try:
> collection = share.get()
>@@ -27,7 +27,7 @@
> User.idle()
> logger.Stop()
> logger.ReportPass("Importing calendar")
>-
>+
> def VerifyEventCreation(title):
> global logger
> global App_ns
>@@ -37,12 +37,12 @@
> logger.ReportPass("Testing event creation: '%s'" % title)
> else:
> logger.ReportFailure("Testing event creation: '%s' not created" % title)
>-
>+
> VerifyEventCreation("Go to the beach")
> VerifyEventCreation("Basketball game")
> VerifyEventCreation("Visit friend")
> VerifyEventCreation("Library")
>-
>+
> logger.SetChecked(True)
> logger.Report()
> finally:
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestMoveToTrash.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestMoveToTrash.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestMoveToTrash.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -2,6 +2,7 @@
> import osaf.framework.scripting as scripting
>
> from time import strftime, localtime
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestMoveToTrash.log"
>@@ -11,7 +12,7 @@
> # creation
> note = QAUITestAppLib.UITestItem("Note", logger)
> # actions
>- note.SetAttr(displayName="A note to move to Trash", body="TO MOVE TO TRASH")
>+ note.SetAttr(displayName=uw("A note to move to Trash"), body=uw("TO MOVE TO TRASH"))
> note.MoveToTrash()
> # verification
> note.Check_ItemInCollection("Trash")
>@@ -25,27 +26,27 @@
>
> sidebar = QAUITestAppLib.App_ns.sidebar
> col = QAUITestAppLib.UITestItem("Collection", logger)
>- col.SetDisplayName("Trash testing")
>- scripting.User.emulate_sidebarClick(sidebar, 'Trash testing')
>+ col.SetDisplayName(uw("Trash testing"))
>+ scripting.User.emulate_sidebarClick(sidebar, uw('Trash testing'))
>
>
> event = QAUITestAppLib.UITestItem("Event", logger)
>
> event.SetAttr(startDate=today, startTime="12:00 PM",
>- displayName="Ephemeral event")
>-
>+ displayName=uw("Ephemeral event"))
>+
> event.SelectItem()
> event.Check_ItemInCollection("All", expectedResult=True)
> event.Check_ItemSelected()
>-
>+
> event.MoveToTrash()
>-
>- scripting.User.emulate_sidebarClick(sidebar, 'My calendar')
>
>+ scripting.User.emulate_sidebarClick(sidebar, "My calendar")
>+
> event.SelectItem(catchException=True)
> event.Check_ItemInCollection("All", expectedResult=False)
> event.Check_ItemSelected(expectedResult=False)
>-
>+
> finally:
> # cleaning
>- logger.Close()
>\ No newline at end of file
>+ logger.Close()
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewCollNoteStampMulti.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewCollNoteStampMulti.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewCollNoteStampMulti.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestNewCollNoteStampMulti.log"
>@@ -20,47 +21,48 @@
> ap.Open() # first, open the accounts dialog window
>
> ap.CreateAccount("SMTP") # create a new SMTP account
>- ap.TypeValue("displayName", "Personal SMTP") # type the following values into their apporpriate fields
>+ ap.TypeValue("displayName", uw("Personal SMTP")) # type the following values into their apporpriate fields
> ap.TypeValue("host","smtp.osafoundation.org")
> ap.SelectValue("security", 'TLS') # select the TLS radio button
> ap.ToggleValue("authentication", True) # turn on the authentication checkbox
> ap.TypeValue("port", '587')
>+ ap.TypeValue("email", "demo1 at osaofundation.org")
> ap.TypeValue('username', 'demo1')
> ap.TypeValue('password', 'ad3leib5')
>-
>+
> ap.CreateAccount("IMAP")
>- ap.TypeValue("displayName", "Personal IMAP")
>+ ap.TypeValue("displayName", uw("Personal IMAP"))
> ap.TypeValue("email", "demo1 at osaofundation.org")
>- ap.TypeValue("name","Demo One")
>+ ap.TypeValue("name",uw("Demo One"))
> ap.TypeValue("host", "imap.osafoundation.org")
> ap.TypeValue("username", "demo1")
> ap.TypeValue("password", "ad3leib5")
> ap.SelectValue("security", "SSL")
> ap.ToggleValue("default", True)
>- ap.SelectValue("server", "Personal SMTP")
>-
>+ ap.SelectValue("server", uw("Personal SMTP"))
>+
> ap.Ok()
> logger.Stop()
>-
>+
> # verification
>- ap.VerifyValues("SMTP", "Personal SMTP", displayName = "Personal SMTP", host= "smtp.osafoundation.org", connectionSecurity = "TLS", useAuth = True, port = 587, username = 'demo1', password = 'ad3leib5' )
>- ap.VerifyValues("IMAP", "Personal IMAP", displayName = "Personal IMAP", host = "imap.osafoundation.org", connectionSecurity = "SSL", username = "demo1", password = "ad3leib5")
>-
>+ ap.VerifyValues("SMTP", uw("Personal SMTP"), displayName = uw("Personal SMTP"), host= "smtp.osafoundation.org", connectionSecurity = "TLS", useAuth = True, port = 587, username = 'demo1', password = 'ad3leib5' )
>+ ap.VerifyValues("IMAP", uw("Personal IMAP"), displayName = uw("Personal IMAP"), host = "imap.osafoundation.org", connectionSecurity = "SSL", username = "demo1", password = "ad3leib5")
>+
> ## End Create accounts for Mail
>-
>+
> # action -- Create new Collection
> col = QAUITestAppLib.UITestItem("Collection", logger)
> # action -- Set the Display name for new Collection
>- col.SetDisplayName("TestCollection")
>+ col.SetDisplayName(uw("TestCollection"))
> # verification -- Initial Existense of Collection
>- col.Check_CollectionExistence("TestCollection")
>-
>+ col.Check_CollectionExistence(uw("TestCollection"))
>+
> # creation
> note = QAUITestAppLib.UITestItem("Note", logger)
> # action -- Add to TestCollection
>- note.AddCollection("TestCollection")
>+ note.AddCollection(uw("TestCollection"))
> # action -- Set Note attributes
>- note.SetAttr(displayName="Test Note in TestCollection", body="This is the body, can i give it \n for new line.")
>+ note.SetAttr(displayName=uw("Test Note in TestCollection"), body=uw("This is the body, can i give it \n for new line."))
> # action -- Stamp as Mail message
> note.StampAsMailMessage(True)
> # action -- Set attributes for mail sending
>@@ -70,20 +72,20 @@
> # action -- Stamp as Calendar message
> note.StampAsCalendarEvent(True)
> # action -- Set Event attributes
>- note.SetAttr(startDate="09/12/2004", startTime="6:00 PM", location="Club101", status="FYI",timeZone="US/Central", recurrence="Daily", recurrenceEnd="9/14/2005")
>+ note.SetAttr(startDate="09/12/2004", startTime="6:00 PM", location=uw("Club101"), status="FYI",timeZone="US/Central", recurrence="Daily", recurrenceEnd="9/14/2005")
>
> # verification -- Collection Display
>- col.Check_CollectionExistence("TestCollection")
>+ col.Check_CollectionExistence(uw("TestCollection"))
> # verification -- note object in TestCollection
>- note.Check_ItemInCollection("TestCollection")
>+ note.Check_ItemInCollection(uw("TestCollection"))
> # verification -- Note Attributes
>- note.Check_DetailView({"displayName":"Test Note in TestCollection","body":"This is the body, can i give it \n for new line."})
>+ note.Check_DetailView({"displayName":uw("Test Note in TestCollection"), "body":uw("This is the body, can i give it \n for new line.")})
> # verification -- Test Stamps
> note.Check_DetailView({"stampMail":True,"stampEvent":True})
> # verification -- Test Mail Attributes
> note.Check_DetailView({"toAddress":"demo2 at osafoundation.org"})
> # verification -- Test Calendar Event Attributes ## Notice that Chandler takes recurrenceEnd="9/14/2005" but the viewer fixes this to display as "9/14/05"
>- note.Check_DetailView({"startDate":"9/12/04","startTime":"6:00 PM","location":"Club101","status":"FYI","timeZone":"US/Central","recurrence":"Daily","recurrenceEnd":"9/14/05"})
>+ note.Check_DetailView({"startDate":"9/12/04","startTime":"6:00 PM","location":uw("Club101"),"status":"FYI","timeZone":"US/Central","recurrence":"Daily","recurrenceEnd":"9/14/05"})
>
>
> finally:
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewCollection.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewCollection.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewCollection.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,5 +1,6 @@
> import tools.QAUITestAppLib as QAUITestAppLib
> import osaf.framework.scripting as scripting
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestNewCollection.log"
>@@ -10,18 +11,18 @@
> col = QAUITestAppLib.UITestItem("Collection", logger)
> # verification
> col.Check_CollectionExistence("Untitled")
>-
>+
> # action
>- col.SetDisplayName("Meeting")
>+ col.SetDisplayName(uw("Meeting"))
> # verification
>- col.Check_CollectionExistence("Meeting")
>-
>+ col.Check_CollectionExistence(uw("Meeting"))
>+
> # action
> note = QAUITestAppLib.UITestItem("Note", logger)
>- note.AddCollection("Meeting")
>+ note.AddCollection(uw("Meeting"))
> # verification
>- note.Check_ItemInCollection("Meeting")
>-
>+ note.Check_ItemInCollection(uw("Meeting"))
>+
> # Bug 5803, make sure items in collections that change to not mine
> # are really not in the All collection, and similarly that events
> # created after the collection becomes not mine are truly not mine
>@@ -29,7 +30,7 @@
> sidebar = QAUITestAppLib.App_ns.sidebar
>
> # select the Meeting collection
>- scripting.User.emulate_sidebarClick(sidebar, 'Meeting')
>+ scripting.User.emulate_sidebarClick(sidebar, uw("Meeting"))
>
> # Switch to the Calendar View
> QAUITestAppLib.App_ns.appbar.press(name="ApplicationBarEventButton")
>@@ -38,22 +39,21 @@
> QAUITestAppLib.scripting.User.idle()
>
> beforeChangeEvent = QAUITestAppLib.UITestItem("Event", logger)
>- beforeChangeEvent.AddCollection("Meeting")
>-
>- beforeChangeEvent.Check_ItemInCollection("Meeting", expectedResult=True)
>+ beforeChangeEvent.AddCollection(uw("Meeting"))
>+ beforeChangeEvent.Check_ItemInCollection(uw("Meeting"), expectedResult=True)
> beforeChangeEvent.Check_ItemInCollection("All", expectedResult=True)
>
> # Change Meeting to stop being in mine
> sidebar.onToggleMineEvent(QAUITestAppLib.App_ns.ToggleMineItem.event)
>
> afterChangeEvent = QAUITestAppLib.UITestItem("Event", logger)
>- afterChangeEvent.AddCollection("Meeting")
>+ afterChangeEvent.AddCollection(uw("Meeting"))
>
> # both events should be in Meeting and not in All
>- beforeChangeEvent.Check_ItemInCollection("Meeting", expectedResult=True)
>+ beforeChangeEvent.Check_ItemInCollection(uw("Meeting"), expectedResult=True)
> beforeChangeEvent.Check_ItemInCollection("All", expectedResult=False)
>
>- afterChangeEvent.Check_ItemInCollection("Meeting", expectedResult=True)
>+ afterChangeEvent.Check_ItemInCollection(uw("Meeting"), expectedResult=True)
> afterChangeEvent.Check_ItemInCollection("All", expectedResult=False)
>
>
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewEvent.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewEvent.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewEvent.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -3,6 +3,7 @@
> from application.dialogs import RecurrenceDialog
> import osaf.framework.scripting as scripting
> import wx
>+from i18n.tests import uw
>
> evtDate = "4/18/05"
> evtSecondDate = "4/19/05"
>@@ -22,17 +23,17 @@
> # Create a vanilla event; leave the timezone alone so we can make sure
> # it's floating.
> event = QAUITestAppLib.UITestItem("Event", logger)
>- event.SetAttr(displayName="Birthday Party",
>- startDate=evtDate,
>+ event.SetAttr(displayName=uw("Birthday Party"),
>+ startDate=evtDate,
> startTime="6:00 PM",
>- location="Club101",
>+ location=uw("Club101"),
> status="FYI",
>- body="This is a birthday party invitation")
>+ body=uw("This is a birthday party invitation"))
>
> # Check a few things: that those attributes got set right, plus
> # a few defaulty things worked (timezone, endtime)
> event.CheckDisplayedValues("Checking initial setup",
>- HeadlineBlock=(True, "Birthday Party"),
>+ HeadlineBlock=(True, uw("Birthday Party")),
> EditAllDay=(True, False),
> EditCalendarStartDate=(True, evtDate),
> CalendarStartAtLabel=(True,),
>@@ -40,15 +41,15 @@
> EditCalendarEndDate=(True, evtDate),
> CalendarEndAtLabel=(True,),
> EditCalendarEndTime=(True, "7:00 PM"),
>- CalendarLocation=(True, "Club101"),
>+ CalendarLocation=(True, uw("Club101")),
> EditTransparency=(True, "FYI"),
>- NotesBlock=(True, "This is a birthday party invitation"),
>+ NotesBlock=(True, uw("This is a birthday party invitation")),
> EditTimeZone=(False, "Floating")) # Not visible with timezones off
>
> # Toggle allday, then make sure the right changes happened.
>- event.SetAttr("Setting allDay", allDay=True)
>+ event.SetAttr("Setting allDay", allDay=True)
> event.CheckDisplayedValues("Checking allday",
>- HeadlineBlock=(True, "Birthday Party"),
>+ HeadlineBlock=(True, uw("Birthday Party")),
> EditAllDay=(True, True),
> EditCalendarStartDate=(True, evtDate),
> CalendarStartAtLabel=(False,),
>@@ -64,7 +65,7 @@
> allDay=False,
> timeZone="US/Mountain")
> event.CheckDisplayedValues("Changed Timezone",
>- HeadlineBlock=(True, "Birthday Party"),
>+ HeadlineBlock=(True, uw("Birthday Party")),
> EditTimeZone=(True, "US/Mountain"),
> EditCalendarStartDate=(True, evtDate),
> EditCalendarEndDate=(True, evtDate),
>@@ -73,7 +74,7 @@
> CalendarStartAtLabel=(True,),
> CalendarEndAtLabel=(True,)
> )
>-
>+
> # Make it recur
> event.SetAttr("Making it recur",
> recurrence="Daily",
>@@ -100,12 +101,12 @@
> else:
> User.emulate_click(recurrenceDialog.thisButton)
> User.idle()
>-
>+
> # Make sure the new second occurrence starts on the right date
> thirdEvent = QAUITestAppLib.UITestItem(masterEvent.getNextOccurrence())
> thirdEvent.SelectItem()
> thirdEvent.CheckDisplayedValues("After deleting second occurrence",
>- HeadlineBlock=(True, "Birthday Party"),
>+ HeadlineBlock=(True, uw("Birthday Party")),
> EditCalendarStartDate=(True, evtThirdDate),
> )
>
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewItem.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewItem.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewItem.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,19 +1,20 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>-
>+from i18n.tests import uw
>+
> # initialization
> fileName = "TestNewItem.log"
> logger = QAUITestAppLib.QALogger(fileName, "TestNewItem")
>
> START_ITEM = QAUITestAppLib.App_ns.DetailRoot.contents
>-
>+
> def switchAndCheck(logger, buttonName, expectedClass):
>
>- name = "TestNewItem(%s)" % (buttonName,)
>+ name = uw("TestNewItem(%s)" % (buttonName,))
> logger.Start(name)
>
> # Switch to the requested view...
> QAUITestAppLib.App_ns.appbar.press(name=buttonName)
>-
>+
> # ... idle() so the app can handle changes
> QAUITestAppLib.scripting.User.idle()
>
>@@ -22,7 +23,7 @@
> # simulate a control/cmd-n here)
> QAUITestAppLib.App_ns.MainView.onNewItemEvent(
> QAUITestAppLib.App_ns.NewItemItem.event)
>-
>+
> # ... wait again so the app can refresh
> QAUITestAppLib.scripting.User.idle()
>
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewMail.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewMail.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewMail.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestNewMail.log"
>@@ -7,13 +8,13 @@
> try:
> # creation
> mail = QAUITestAppLib.UITestItem("MailMessage", logger)
>-
>+
> # action
>- mail.SetAttr(displayName="Invitation Mail", toAddress="demo2 at osafoundation.org", body="This is an email to invite you")
>+ mail.SetAttr(displayName=uw("Invitation Mail"), toAddress="demo2 at osafoundation.org", body=uw("This is an email to invite you"))
> mail.SendMail()
>-
>+
> # verification
>- mail.Check_DetailView({"displayName":"Invitation Mail","body":"This is an email to invite you"})
>+ mail.Check_DetailView({"displayName":uw("Invitation Mail"),"toAddress":"demo2 at osafoundation.org","body":uw("This is an email to invite you")})
>
> finally:
> #cleaning
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewNote.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewNote.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewNote.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,5 +1,6 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>-
>+from i18n.tests import uw
>+
> # initialization
> fileName = "TestNewNote.log"
> logger = QAUITestAppLib.QALogger(fileName, "TestNewNote")
>@@ -7,12 +8,12 @@
> try:
> # creation
> note = QAUITestAppLib.UITestItem("Note", logger)
>-
>+
> # action
>- note.SetAttr(displayName="A note to myself about filing taxes", body="FILE TAXES!")
>-
>+ note.SetAttr(displayName=uw("A note to myself about filing taxes"), body=uw("FILE TAXES!"))
>+
> # verification
>- note.Check_DetailView({"displayName":"A note to myself about filing taxes","body":"FILE TAXES!"})
>+ note.Check_DetailView({"displayName":uw("A note to myself about filing taxes"),"body":uw("FILE TAXES!")})
>
> finally:
> # cleaning
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestNewTask.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestNewTask.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestNewTask.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestNewTask.log"
>@@ -9,10 +10,10 @@
> task = QAUITestAppLib.UITestItem("Task", logger)
>
> # action
>- task.SetAttr(displayName="Task of sending birthday invites", body="Send birthday invitations")
>+ task.SetAttr(displayName=uw("Task of sending birthday invites"), body=uw("Send birthday invitations"))
>
> # verification
>- task.Check_DetailView({"displayName":"Task of sending birthday invites","body":"Send birthday invitations"})
>+ task.Check_DetailView({"displayName":uw("Task of sending birthday invites"),"body":uw("Send birthday invitations")})
>
> finally:
> # cleaning
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestRecurringEvent.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestRecurringEvent.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestRecurringEvent.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -1,4 +1,5 @@
> import tools.QAUITestAppLib as QAUITestAppLib
>+from i18n.tests import uw
>
> # initialization
> fileName = "TestRecurringEvent.log"
>@@ -11,37 +12,37 @@
> dailyEvent = QAUITestAppLib.UITestItem("Event", logger)
>
> # action
>- dailyEvent.SetAttr(displayName="Daily Exercise",
>- startDate="01/01/2006",
>- startTime="6:00 AM",
>- location="Gym",
>+ dailyEvent.SetAttr(displayName=uw("Daily Exercise"),
>+ startDate="01/01/2006",
>+ startTime="6:00 AM",
>+ location=uw("Gym"),
> status="FYI",
>- body="Resolution: exercise daily for optimal health",
>- timeZone="US/Central",
>- recurrence="Daily",
>+ body=uw("Resolution: exercise daily for optimal health"),
>+ timeZone="US/Central",
>+ recurrence="Daily",
> recurrenceEnd="03/01/2006")
>
> # verification
>- dailyEvent.Check_DetailView({"displayName":"Daily Exercise",
>+ dailyEvent.Check_DetailView({"displayName":uw("Daily Exercise"),
> "startDate":"1/1/06",
> "endDate":"1/1/06",
> "startTime":"6:00 AM",
> "endTime":"7:00 AM",
>- "location":"Gym",
>+ "location":uw("Gym"),
> "status":"FYI",
>- "body":"Resolution: exercise daily for optimal health",
>+ "body":uw("Resolution: exercise daily for optimal health"),
> "timeZone":"US/Central",
> "recurrence":"Daily",
> "recurrenceEnd":"3/1/06"})
>
>- dailyEvent.Check_Object({"displayName":"Daily Exercise",
>+ dailyEvent.Check_Object({"displayName":uw("Daily Exercise"),
> "startDate":"1/1/2006",
> "endDate":"1/1/2006",
> "startTime":"6:00 AM",
> "endTime":"7:00 AM",
>- "location":"Gym",
>+ "location":uw("Gym"),
> "status":"FYI",
>- "body":"Resolution: exercise daily for optimal health",
>+ "body":uw("Resolution: exercise daily for optimal health"),
> "timeZone":"US/Central"})
>
> # Weekly Event Test
>@@ -50,125 +51,119 @@
> weeklyEvent = QAUITestAppLib.UITestItem("Event", logger)
>
> # action
>- weeklyEvent.SetAttr(displayName="Weekly call home",
>+ weeklyEvent.SetAttr(displayName=uw("Weekly call home"),
> startDate="01/07/2006",
> startTime="5:00 PM",
>- location="Phone",
>+ location=uw("Phone"),
> status="FYI",
>- body="Resolution: call home weekly for good family relations",
>+ body=uw("Resolution: call home weekly for good family relations"),
> timeZone="US/Central",
> recurrence="Weekly",
> recurrenceEnd="03/25/2006")
>
> # verification
>-
>- weeklyEvent.Check_DetailView({"displayName":"Weekly call home",
>+ weeklyEvent.Check_DetailView({"displayName":uw("Weekly call home"),
> "startDate":"1/7/06",
> "endDate":"1/7/06",
> "startTime":"5:00 PM",
> "endTime":"6:00 PM",
>- "location":"Phone",
>+ "location":uw("Phone"),
> "status":"FYI",
>- "body":"Resolution: call home weekly for good family relations",
>+ "body":uw("Resolution: call home weekly for good family relations"),
> "timeZone":"US/Central",
> "recurrence":"Weekly",
> "recurrenceEnd":"3/25/06"})
>
>- weeklyEvent.Check_Object({"displayName":"Weekly call home",
>+ weeklyEvent.Check_Object({"displayName":uw("Weekly call home"),
> "startDate":"1/7/2006",
> "endDate":"1/7/2006",
> "startTime":"5:00 PM",
> "endTime":"6:00 PM",
>- "location":"Phone",
>+ "location":uw("Phone"),
> "status":"FYI",
>- "body":"Resolution: call home weekly for good family relations",
>+ "body":uw("Resolution: call home weekly for good family relations"),
> "timeZone":"US/Central"})
>-
>+
> # Monthly Event Test
>-
> # creation
> monthlyEvent = QAUITestAppLib.UITestItem("Event", logger)
>-
>+
> # action
>- monthlyEvent.SetAttr(displayName="Monthly book club",
>+ monthlyEvent.SetAttr(displayName=uw("Monthly book club"),
> startDate="01/01/2006",
> startTime="7:00 PM",
> endTime="9:00 PM",
>- location="My house",
>+ location=uw("My house"),
> status="CONFIRMED",
>- body="Resolution: host book club once a month",
>+ body=uw("Resolution: host book club once a month"),
> timeZone="US/Central",
> recurrence="Monthly",
> recurrenceEnd="12/31/2006")
>-
>+
> # verification
>-
>- monthlyEvent.Check_DetailView({"displayName":"Monthly book club",
>+
>+ monthlyEvent.Check_DetailView({"displayName":uw("Monthly book club"),
> "startDate":"1/1/06",
> "endDate":"1/1/06",
> "startTime":"7:00 PM",
> "endTime":"9:00 PM",
>- "location":"My house",
>+ "location":uw("My house"),
> "status":"Confirmed",
>- "body":"Resolution: host book club once a month",
>+ "body":uw("Resolution: host book club once a month"),
> "timeZone":"US/Central",
> "recurrence":"Monthly",
> "recurrenceEnd":"12/31/06"})
>
>- monthlyEvent.Check_Object({"displayName":"Monthly book club",
>+ monthlyEvent.Check_Object({"displayName":uw("Monthly book club"),
> "startDate":"1/1/2006",
> "endDate":"1/1/2006",
> "startTime":"7:00 PM",
> "endTime":"9:00 PM",
>- "location":"My house",
>+ "location":uw("My house"),
> "status":"CONFIRMED",
>- "body":"Resolution: host book club once a month",
>+ "body":uw("Resolution: host book club once a month"),
> "timeZone":"US/Central"})
>-
>+
> # Yearly Event Test
>
> # creation
> yearlyEvent = QAUITestAppLib.UITestItem("Event", logger)
>
> # action
>- yearlyEvent.SetAttr(displayName="Yearly dentist appointment",
>+ yearlyEvent.SetAttr(displayName=uw("Yearly dentist appointment"),
> startDate="02/06/2006",
> startTime="10:00 AM",
>- location="Downtown",
>+ location=uw("Downtown"),
> status="CONFIRMED",
>- body="Resolution: get teeth cleaned once a year",
>+ body=uw("Resolution: get teeth cleaned once a year"),
> timeZone="US/Pacific",
> recurrence="Yearly",
> recurrenceEnd="02/07/2010")
>
> # verification
>-
>- yearlyEvent.Check_DetailView({"displayName":"Yearly dentist appointment",
>+
>+ yearlyEvent.Check_DetailView({"displayName":uw("Yearly dentist appointment"),
> "startDate":"2/6/06",
> "endDate":"2/6/06",
> "startTime":"10:00 AM",
> "endTime":"11:00 AM",
>- "location":"Downtown",
>+ "location":uw("Downtown"),
> "status":"Confirmed",
>- "body":"Resolution: get teeth cleaned once a year",
>+ "body":uw("Resolution: get teeth cleaned once a year"),
> "timeZone":"US/Pacific",
> "recurrence":"Yearly",
> "recurrenceEnd":"2/7/10"})
>
>- yearlyEvent.Check_Object({"displayName":"Yearly dentist appointment",
>+ yearlyEvent.Check_Object({"displayName":uw("Yearly dentist appointment"),
> "startDate":"2/6/2006",
> "endDate":"2/6/2006",
> "startTime":"10:00 AM",
> "endTime":"11:00 AM",
>- "location":"Downtown",
>+ "location":uw("Downtown"),
> "status":"CONFIRMED",
>- "body":"Resolution: get teeth cleaned once a year",
>+ "body":uw("Resolution: get teeth cleaned once a year"),
> "timeZone":"US/Pacific"})
>
>-
>-
>-
>-
> finally:
> # cleaning
> logger.Close()
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestRemoveFromTrashOnImport.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestRemoveFromTrashOnImport.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestRemoveFromTrashOnImport.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -5,7 +5,6 @@
> import tools.QAUITestAppLib as QAUITestAppLib
> import os, sys
> from time import localtime, strftime
>-from i18n import OSAFMessageFactory as _
> import osaf.sharing.Sharing as Sharing
> import osaf.sharing.ICalendar as ICalendar
> import osaf.framework.scripting as scripting
>@@ -39,7 +38,7 @@
> if os.path.exists(fullpath):
> os.remove(fullpath)
> reportDir = unicode(reportDir, sys.getfilesystemencoding())
>-
>+
> #export
> share = Sharing.OneTimeFileSystemShare(reportDir, u'deleteThenImport.ics', ICalendar.ICalendarFormat, itsView=appView)
> share.contents = collection.item
>@@ -61,4 +60,4 @@
>
> finally:
> #cleaning
>- logger.Close()
>\ No newline at end of file
>+ logger.Close()
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestSharing.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestSharing.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestSharing.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -7,6 +7,7 @@
> import osaf.sharing.ICalendar as ICalendar
> import tools.QAUITestAppLib as QAUITestAppLib
> import osaf.pim as pim
>+from i18n.tests import uw
> from osaf.framework.blocks.Block import Block
>
> App_ns = app_ns()
>@@ -14,7 +15,7 @@
> # initialization
> fileName = "TestSharing.log"
> logger = QAUITestAppLib.QALogger(fileName, "TestSharing")
>-
>+
> try:
> # action
> # Webdav Account Setting
>@@ -22,7 +23,7 @@
> ap = QAUITestAppLib.UITestAccounts(logger)
> ap.Open() # first, open the accounts dialog window
> ap.CreateAccount("WebDAV")
>- ap.TypeValue("displayName", "Sharing Test WebDAV")
>+ ap.TypeValue("displayName", uw("Sharing Test WebDAV"))
> ap.TypeValue("host", "qacosmo.osafoundation.org")
> ap.TypeValue("path", "cosmo/home/demo1")
> ap.TypeValue("username", "demo1")
>@@ -34,16 +35,15 @@
> logger.Stop()
>
> # verification
>- ap.VerifyValues("WebDAV", "Sharing Test WebDAV", displayName = "Sharing Test WebDAV", host = "qacosmo.osafoundation.org", username = "demo1",
>- password="ad3leib5", port=8080)
>-
>-
>+ ap.VerifyValues("WebDAV", uw("Sharing Test WebDAV"), displayName = uw("Sharing Test WebDAV"), host = "qacosmo.osafoundation.org", username = "demo1", password="ad3leib5", port=8080)
>+
>+
> # import events so test will have something to share even when run by itself
> path = os.path.join(os.getenv('CHANDLERHOME'),"tools/QATestScripts/DataFiles")
> # Upcast path to unicode since Sharing requires a unicode path
> path = unicode(path, sys.getfilesystemencoding())
> share = Sharing.OneTimeFileSystemShare(path, u'testSharing.ics', ICalendar.ICalendarFormat, itsView=App_ns.itsView)
>-
>+
> logger.Start("Import testSharing Calendar")
> try:
> collection = share.get()
>@@ -55,11 +55,11 @@
> User.idle()
> logger.Stop()
> logger.ReportPass("Importing calendar")
>-
>+
> # Collection selection
> sidebar = App_ns.sidebar
> QAUITestAppLib.scripting.User.emulate_sidebarClick(sidebar, "testSharing")
>-
>+
> # Sharing dialog
> logger.Start("Sharing dialog")
> collection = Block.findBlockByName("MainView").getSidebarSelectedCollection()
>@@ -88,8 +88,8 @@
> # so remove this one when done
> # Note: We don't need a try: here if this raises, the
> # test has already reported success.
>- unpublish(collection)
>-
>+ unpublish(collection)
>+
> finally:
> # cleaning
> logger.Close()
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -2,7 +2,7 @@
> import os
> import application.dialogs.SubscribeCollection as SubscribeCollection
> import wx
>-from i18n import OSAFMessageFactory as _
>+from i18n.tests import uw
>
> App_ns = app_ns()
>
>@@ -17,7 +17,7 @@
> ap = QAUITestAppLib.UITestAccounts(logger)
> ap.Open() # first, open the accounts dialog window
> ap.CreateAccount("WebDAV")
>- ap.TypeValue("displayName", "Subscribe Test WebDAV")
>+ ap.TypeValue("displayName", uw("Subscribe Test WebDAV"),
> ap.TypeValue("host", "qacosmo.osafoundation.org")
> ap.TypeValue("path", "home/demo1")
> ap.TypeValue("username", "demo1")
>@@ -29,9 +29,8 @@
> logger.Stop()
>
> # verification
>- ap.VerifyValues("WebDAV", "Subscribe Test WebDAV", displayName = "Subscribe Test WebDAV", host = "qacosmo.osafoundation.org", username = "demo1",
>- password="ad3leib5", port=8080)
>-
>+ ap.VerifyValues("WebDAV", uw("Subscribe Test WebDAV"), displayName = uw("Subscribe Test WebDAV"), host = "qacosmo.osafoundation.org", path = "home/demo1", username = "demo1", password="ad3leib5", port=8080)
>+
> # Subscribe dialog
> logger.Start("Subscribe dialog")
> window = SubscribeCollection.Show(wx.GetApp().mainFrame,
>
>
> Modified:
> trunk/chandler/tools/QATestScripts/Functional/TestTableSelection.py
> (10797 => 10798)
>
>--- trunk/chandler/tools/QATestScripts/Functional/TestTableSelection.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QATestScripts/Functional/TestTableSelection.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -26,11 +26,11 @@
> mail.SetAttr(displayName="Mail Message %s" % (ITEM_COUNT-i),
> toAddress = "%s at osafoundation.org" % alpha[i])
> items.append(mail.item)
>-
>+
> # action
> dashboardBlock = App_ns.TableSummaryView
> dashboard = dashboardBlock.widget
>-
>+
> User.emulate_click(dashboard, 20, 20)
> User.idle()
>
>@@ -40,13 +40,13 @@
>
> # select the first row
> User.emulate_click(dashboard, 100, rowsToSelect[0]*rowHeight + rowMiddle)
>-
>+
> # select 3 more rows, with control key down for multi selection
> for row in rowsToSelect[1:]:
> User.emulate_click(dashboard, 100,
> rowHeight*row + rowMiddle,
> control=True)
>-
>+
> # verification
>
> # check selection indexes
>@@ -96,10 +96,10 @@
> newSelectedItems.sort(key=lambda x: x.itsUUID)
> view.Check_Equality(expectedItems, newSelectedItems, "Selection by item after sorting #2")
>
>-
>+
> logger.Report("Table Selection")
>-
>+
> finally:
> pass
> logger.Close()
>-
>+
>
>
> Modified: trunk/chandler/tools/QAUITestAppLib.py (10797 => 10798)
>
>--- trunk/chandler/tools/QAUITestAppLib.py 2006-05-30 23:12:44 UTC (rev 10797)
>+++ trunk/chandler/tools/QAUITestAppLib.py 2006-05-31 00:34:12 UTC (rev 10798)
>@@ -30,13 +30,13 @@
> if minute == 0:
> minute = "00"
> else:
>- minute = "%s" %minute
>+ minute = u"%s" % minute
> if hour > 12:
> hour = hour - 12
> minute = minute + " PM"
> else:
> minute = minute + " AM"
>- return "%s:%s" %(hour, minute)
>+ return u"%s:%s" % (hour, minute)
>
> def GetCollectionRow(cellName):
> """
>@@ -100,7 +100,7 @@
> self.allDay = self.recurring = False
> self.view = App_ns.itsView
> self.logger = logger
>- if self.logger: self.logger.Start("%s creation" %type)
>+ if self.logger: self.logger.Start("%s creation" % type)
>
> setattr(self, 'is' + type, True)
> constructorName = DataTypes[type]
>@@ -227,7 +227,7 @@
> #select the item
> self.SelectItem()
> if timeInfo:
>- if self.logger: self.logger.Start("%s setting" %description)
>+ if self.logger: self.logger.Start("%s setting" % description)
> block = getattr(App_ns, blockName)
> # Emulate the mouse click in the display name block
> scripting.User.emulate_click(block)
>@@ -259,7 +259,7 @@
> return False
> else:
> if timeInfo:
>- if self.logger: self.logger.Start("%s setting" %menuName)
>+ if self.logger: self.logger.Start("%s setting" % menuName)
> # Emulate the mouse click in the menu
> scripting.User.emulate_click(block)
> block.widget.SetStringSelection(menuChoice)
>@@ -508,7 +508,7 @@
> # select the item
> self.SelectItem()
> if timeInfo :
>- if self.logger: self.logger.Start("Change the %s stamp" %type)
>+ if self.logger: self.logger.Start("Change the %s stamp" % type)
> # markup bar tests disabled for now -- Reid
> buttonBlock = getattr(App_ns, type_states[type]['button'])
> scripting.User.emulate_click(buttonBlock, 10, 10)
>@@ -763,8 +763,8 @@
> # Did we get what we wanted?
> if isVisible != shouldBeVisible:
> self.logger.ReportFailure("(On %s Visibility) || detail view "
>- "= %s ; expected value = %s" %
>- (blockName, isVisible,
>+ "= %s ; expected value = %s" %
>+ (blockName, isVisible,
> shouldBeVisible))
> else:
> self.logger.ReportPass("(On %s Visibility)" % blockName)
>@@ -788,9 +788,9 @@
> valueMethod = getattr(block.widget, 'GetStringSelection')
> blockValue = valueMethod()
> if not blockValue == value :
>- if self.logger: self.logger.ReportFailure("(On %s Checking) || detail view value = %s ; expected value = %s" %(description, blockValue, value))
>+ if self.logger: self.logger.ReportFailure("(On %s Checking) || detail view value = %s ; expected value = %s" % (description, blockValue, value))
> else:
>- if self.logger: self.logger.ReportPass("(On %s Checking)" %description)
>+ if self.logger: self.logger.ReportPass("(On %s Checking)" % description)
>
> def CheckMenuBlock(self, blockName, description, value):
> """
>@@ -807,10 +807,10 @@
> #get the menu block value
> menuValue = block.widget.GetStringSelection()
> if not menuValue == value :
>- if self.logger: self.logger.ReportFailure("(On %s Checking) || detail view value = %s ; expected value = %s" %(description, menuValue, value))
>+ if self.logger: self.logger.ReportFailure("(On %s Checking) || detail view value = %s ; expected value = %s" % (description, menuValue, value))
> else:
>- if self.logger: self.logger.ReportPass("(On %s Checking)" %description)
>-
>+ if self.logger: self.logger.ReportPass("(On %s Checking)" % description)
>+
> def formatDate(self, dateStr):
> """if year has 4 digits removes first 2
> also removes leading zeros from month/ day
>@@ -820,9 +820,9 @@
> day = str(int(day))
> if len(year) == 4:
> year = year[2:]
>- return '%s/%s/%s' % (month, day, year)
>-
>+ return u'%s/%s/%s' % (month, day, year)
>
>+
> def CheckButton(self, buttonName, description, value):
> """
> Check the current state of the given button
>@@ -837,10 +837,10 @@
> buttonBlock = getattr(App_ns, buttonName)
> state = buttonBlock.isStamped()
> if not state == value :
>- if self.logger: self.logger.ReportFailure("(On %s Checking) || detail view value = %s ; expected value = %s" %(description, state, value))
>+ if self.logger: self.logger.ReportFailure("(On %s Checking) || detail view value = %s ; expected value = %s" % (description, state, value))
> else:
>- if self.logger: self.logger.ReportPass("(On %s Checking)" %description)
>-
>+ if self.logger: self.logger.ReportPass("(On %s Checking)" % description)
>+
> def CheckDisplayedValues(self, msg="Displayed Values", **dict):
> """
> Check that these blocks have the right values and visibility and values
>@@ -927,90 +927,92 @@
> for field,value in dict.iteritems():
> if field == "displayName": # display name checking
> if self.isMailMessage:
>- d_name = "%s" %self.item.subject
>+ d_name = self.item.subject
> else:
>- d_name = "%s" %self.item.displayName
>- if not value == d_name :
>- if self.logger: self.logger.ReportFailure("(On display name Checking) || object title = %s ; expected title = %s" %(d_name, value))
>+ d_name = self.item.displayName
>+ if not value == d_name:
>+ if self.logger: self.logger.ReportFailure("(On display name Checking) || object title = %s ; expected title = %s" % (d_name, value))
> else:
> if self.logger: self.logger.ReportPass("(On display name Checking)")
> elif field == "startDate": # start date checking
> startTime = self.item.startTime
>- s_date = self.formatDate("%s/%s/%s" %(startTime.month, startTime.day, startTime.year) )
>+ s_date = self.formatDate("%s/%s/%s" % (startTime.month, startTime.day, startTime.year) )
> dictDate = self.formatDate(value)
> if not dictDate == s_date :
>- if self.logger: self.logger.ReportFailure("(On start date Checking) || object start date = %s ; expected start date = %s" %(s_date, dictDate))
>+ if self.logger: self.logger.ReportFailure("(On start date Checking) || object start date = %s ; expected start date = %s" % (s_date, dictDate))
> else:
> if self.logger: self.logger.ReportPass("(On start date Checking)")
> elif field == "startTime": # start time checking
> startTime = self.item.startTime
> s_time = getTime(startTime)
> if not value == s_time :
>- if self.logger: self.logger.ReportFailure("(On start time Checking) || object start time = %s ; expected start time = %s" %(s_time, value))
>+ if self.logger: self.logger.ReportFailure("(On start time Checking) || object start time = %s ; expected start time = %s" % (s_time, value))
> else:
> if self.logger: self.logger.ReportPass("(On start time Checking)")
> elif field == "endDate": # end date checking
> endTime = self.item.endTime
>- e_date = self.formatDate("%s/%s/%s" %(endTime.month, endTime.day, endTime.year))
>+ e_date = self.formatDate("%s/%s/%s" % (endTime.month, endTime.day, endTime.year))
> dictDate = self.formatDate(value)
> if not dictDate == e_date :
>- if self.logger: self.logger.ReportFailure("(On end date Checking) || object end date = %s ; expected end date = %s" %(e_date, dictDate))
>+ if self.logger: self.logger.ReportFailure("(On end date Checking) || object end date = %s ; expected end date = %s" % (e_date, dictDate))
> else:
> if self.logger: self.logger.ReportPass("(On end date Checking)")
> elif field == "endTime": # end time checking
> endTime = self.item.endTime
> e_time = getTime(endTime)
> if not value == e_time :
>- if self.logger: self.logger.ReportFailure("(On end time Checking) || object end time = %s ; expected end time = %s" %(e_time, value))
>+ if self.logger: self.logger.ReportFailure("(On end time Checking) || object end time = %s ; expected end time = %s" % (e_time, value))
> else:
> if self.logger: self.logger.ReportPass("(On end time Checking)")
> elif field == "location": # location checking
>- loc = "%s" %self.item.location
>- if not value == loc :
>- if self.logger: self.logger.ReportFailure("(On location Checking) || object location = %s ; expected location = %s" %(loc, value))
>+ #Convert the location item to a unicode string
>+ loc = unicode(self.item.location)
>+
>+ if not value == loc:
>+ if self.logger: self.logger.ReportFailure("(On location Checking) || object location = %s ; expected location = %s" % (loc, value))
> else:
> if self.logger: self.logger.ReportPass("(On location Checking)")
> elif field == "body": # body checking
>- body = "%s" %self.item.body
>- if not value == body :
>+ body = self.item.body
>+ if not value == body:
> if self.logger: self.logger.ReportFailure("(On body Checking) || object body = %s ; expected body = %s" %(body, value))
> else:
> if self.logger: self.logger.ReportPass("(On body Checking)")
> elif field == "fromAddress": # from address checking
>- f = "%s" %self.item.fromAddress
>+ f = self.item.fromAddress
> if not value == f :
>- if self.logger: self.logger.ReportFailure("(On from address Checking) || object from address = %s ; expected from address = %s" %(f, value))
>+ if self.logger: self.logger.ReportFailure("(On from address Checking) || object from address = %s ; expected from address = %s" % (f, value))
> else:
> if self.logger: self.logger.ReportPass("(On from address Checking)")
> elif field == "toAddress": # to address checking
>- t = "%s" %self.item.toAddress
>- if not value == t :
>- if self.logger: self.logger.ReportFailure("(On to address Checking) || object to address = %s ; expected to address = %s" %(t, value))
>+ t = self.item.toAddress
>+ if not value == t:
>+ if self.logger: self.logger.ReportFailure("(On to address Checking) || object to address = %s ; expected to address = %s" % (t, value))
> else:
> if self.logger: self.logger.ReportPass("(On to address Checking)")
> elif field == "status": # status checking
>- status = "%s" %string.upper(self.item.transparency)
>- if not value == status :
>- if self.logger: self.logger.ReportFailure("(On status Checking) || object status = %s ; expected status = %s" %(status, value))
>+ status = self.item.transparency.upper()
>+ if not value == status:
>+ if self.logger: self.logger.ReportFailure("(On status Checking) || object status = %s ; expected status = %s" % (status, value))
> else:
> if self.logger: self.logger.ReportPass("(On status Checking)")
> elif field == "timeZone": # time zone checking
>- timeZone = "%s" %self.item.startTime.tzname()
>+ timeZone = self.item.startTime.tzname()
> if not value == timeZone :
>- if self.logger: self.logger.ReportFailure("(On time zone Checking) || object time zone = %s ; expected time zone = %s" %(timeZone, value))
>+ if self.logger: self.logger.ReportFailure("(On time zone Checking) || object time zone = %s ; expected time zone = %s" % (timeZone, value))
> else:
> if self.logger: self.logger.ReportPass("(On time zone Checking)")
> elif field == "alarm": # status checking
> alarm = self.item.startTime - self.item.reminderTime
> field = timedelta(minutes = string.atoi(value))
>- if not field == alarm :
>- if self.logger: self.logger.ReportFailure("(On alarm Checking) || object alarm = %s ; expected alarm = %s" %(alarm, field))
>+ if not field == alarm:
>+ if self.logger: self.logger.ReportFailure("(On alarm Checking) || object alarm = %s ; expected alarm = %s" % (alarm, field))
> else:
> if self.logger: self.logger.ReportPass("(On alarm Checking)")
> elif field == "allDay": # status checking
> allDay = self.item.allDay
>- if not value == allDay :
>- if self.logger: self.logger.ReportFailure("(On all Day Checking) || object all day = %s ; expected all day = %s" %(allDay, value))
>+ if not value == allDay:
>+ if self.logger: self.logger.ReportFailure("(On all Day Checking) || object all day = %s ; expected all day = %s" % (allDay, value))
> else:
> if self.logger: self.logger.ReportPass("(On all Day Checking)")
> elif field == "stampMail": # Mail stamp checking
>@@ -1018,8 +1020,8 @@
> stampMail = True
> else:
> stampMail = False
>- if not value == stampMail :
>- if self.logger: self.logger.ReportFailure("(On Mail Stamp Checking) || object Mail Stamp = %s ; expected Mail Stamp = %s" %(stampMail, value))
>+ if not value == stampMail:
>+ if self.logger: self.logger.ReportFailure("(On Mail Stamp Checking) || object Mail Stamp = %s ; expected Mail Stamp = %s" % (stampMail, value))
> else:
> if self.logger: self.logger.ReportPass("(On Mail Stamp Checking)")
> elif field == "stampTask": # Task stamp checking
>@@ -1027,8 +1029,8 @@
> stampTask = True
> else:
> stampTask = False
>- if not value == stampTask :
>- if self.logger: self.logger.ReportFailure("(On Task Stamp Checking) || object Task Stamp = %s ; expected Task Stamp = %s" %(stampTask, value))
>+ if not value == stampTask:
>+ if self.logger: self.logger.ReportFailure("(On Task Stamp Checking) || object Task Stamp = %s ; expected Task Stamp = %s" % (stampTask, value))
> else:
> if self.logger: self.logger.ReportPass("(On Task Stamp Checking)")
> elif field == "stampEvent": # Event stamp checking
>@@ -1036,8 +1038,8 @@
> stampEvent = True
> else:
> stampEvent = False
>- if not value == stampEvent :
>- if self.logger: self.logger.ReportFailure("(On Event Stamp Checking) || object Event Stamp = %s ; expected Event Stamp = %s" %(stampEvent, value))
>+ if not value == stampEvent:
>+ if self.logger: self.logger.ReportFailure("(On Event Stamp Checking) || object Event Stamp = %s ; expected Event Stamp = %s" % (stampEvent, value))
> else:
> if self.logger: self.logger.ReportPass("(On Event Stamp Checking)")
> else: # Wrong check => set the report state to unchecked
>@@ -1077,19 +1079,19 @@
> # check the changing values
> if not GetCollectionRow(self.item.displayName):
> exist = False
>- description = "%s doesn't exist" %self.item.displayName
>+ description = u"%s doesn't exist" % self.item.displayName
> else:
> exist = True
>- description = "%s exists" %self.item.displayName
>+ description = u"%s exists" % self.item.displayName
> #report the checkings
> if exist == expectedResult and self.item.displayName == expectedName:
>- if self.logger: self.logger.ReportPass("(On collection existence Checking) - %s" %description)
>+ if self.logger: self.logger.ReportPass("(On collection existence Checking) - %s" % description)
> result = True
> elif not exist == expectedResult:
>- if self.logger: self.logger.ReportFailure("(On collection existence Checking) - %s" %description)
>+ if self.logger: self.logger.ReportFailure("(On collection existence Checking) - %s" % description)
> result = False
> else:
>- if self.logger: self.logger.ReportFailure("(On collection name Checking) - current name = %s ; expected name = %s" %(self.item.displayName, expectedName))
>+ if self.logger: self.logger.ReportFailure("(On collection name Checking) - current name = %s ; expected name = %s" % (self.item.displayName, expectedName))
> result = False
> if self.logger: self.logger.Report("Collection existence")
> return result
>@@ -1113,19 +1115,19 @@
> App_ns.AllDayEvents.widget.SelectedItems() )
> else:
> selected = self.item in App_ns.summary.widget.SelectedItems()
>-
>+
> if selected:
>- description = "item named %s is selected" % self.item.displayName
>+ description = u"item named %s is selected" % self.item.displayName
> else:
>- description = "item named %s is not selected" %self.item.displayName
>+ description = u"item named %s is not selected" % self.item.displayName
> if selected == expectedResult:
> result = True
> if report:
>- if self.logger: self.logger.ReportPass("(On Selection Checking) - %s" %description)
>+ if self.logger: self.logger.ReportPass("(On Selection Checking) - %s" % description)
> else:
> result = False
> if report:
>- if self.logger: self.logger.ReportFailure("(On Selection Checking) - %s" %description)
>+ if self.logger: self.logger.ReportFailure("(On Selection Checking) - %s" % description)
> return result
>
>
>@@ -1153,19 +1155,19 @@
> if col:
> if self.item in col:
> value = True
>- description = "item named %s is in %s" %(self.item.displayName, collectionName)
>+ description = u"item named %s is in %s" % (self.item.displayName, collectionName)
> else:
> value = False
>- description = "item named %s is not in %s" %(self.item.displayName, collectionName)
>+ description = u"item named %s is not in %s" % (self.item.displayName, collectionName)
> if value == expectedResult:
> result = True
> if report:
>- if self.logger: self.logger.ReportPass("(On Collection Checking) - %s" %description)
>+ if self.logger: self.logger.ReportPass("(On Collection Checking) - %s" % description)
> if self.logger: self.logger.Report("Item in collection")
> else:
> result = False
> if report:
>- if self.logger: self.logger.ReportFailure("(On Collection Checking) - %s" %description)
>+ if self.logger: self.logger.ReportFailure("(On Collection Checking) - %s" % description)
> if self.logger: self.logger.Report("Item in collection")
> else:
> result = False
>@@ -1202,7 +1204,7 @@
>
> class UITestAccounts:
> fieldMap = {
>- 'SMTP': {'displayName': 3, 'address': 5, 'host': 7,
>+ 'SMTP': {'displayName': 3, 'email': 5, 'host': 7,
> 'username': 17, 'password': 19, 'security': 9,
> 'port':13, 'authentication': 15},
>
>@@ -1343,7 +1345,7 @@
> iter = Mail.POPAccount.iterItems(App_ns.itsView)
> else:
> raise AttributeError
>-
>+
> for account in iter:
> if account.displayName == name:
> break
>@@ -1351,7 +1353,7 @@
> if self.logger: self.logger.ReportFailure("No such account: %s" % name)
> result = False
> account = None
>-
>+
> if account is not None:
> if self.logger: self.logger.SetChecked(True)
> result = True
>@@ -1430,7 +1432,7 @@
> else:
> return False
> self.state = viewName
>- if self.logger: self.logger.Start("Switch to %s" %viewName)
>+ if self.logger: self.logger.Start("Switch to %s" % viewName)
> #process the corresponding event
> App_ns.appbar.press(name=button)
> wx.GetApp().Yield()
>@@ -1464,10 +1466,10 @@
> def CheckView(self):
> """
> Check if the current view is the expected one
>- """
>+ """
> if self.logger: self.logger.SetChecked(True)
> if not self.state == self.GetCurrentState():
>- if self.logger: self.logger.ReportFailure("(On wiew checking) || expected current view = %s ; Correspondig button is switch off " %self.state)
>+ if self.logger: self.logger.ReportFailure("(On wiew checking) || expected current view = %s ; Corresponding button is switch off " % self.state)
> else:
> if self.logger: self.logger.ReportPass("(On view checking)")
> #report the checkings
>@@ -1567,7 +1569,7 @@
> TestItem = UITestItem(canvasItem.item, self.logger)
> return TestItem
> else:
>- if self.logger: self.logger.Print("DoubleClickInCalView is not available in the current view : %s" %self.state)
>+ if self.logger: self.logger.Print("DoubleClickInCalView is not available in the current view : %s" % self.state)
> return
>
> def Check_Equality(self, a, b, message):
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Commits mailing list
>Commits at osafoundation.org
>http://lists.osafoundation.org/mailman/listinfo/commits
>
>
More information about the chandler-dev
mailing list