- Revision
- 11426
- Author
- heikki
- Date
- 2006-08-16 15:46:04 -0700 (Wed, 16 Aug 2006)
Log Message
Bug 6161, functional and performance sharing tests are now implemented
the same way. The sharing test consists of publish and subscribe
parts.
the same way. The sharing test consists of publish and subscribe
parts.
Modified Paths
- trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py
- trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py
- trunk/chandler/tools/QATestScripts/Functional/TestSharing.py
- trunk/chandler/tools/QATestScripts/Performance/PerfLargeDataSharing.py
- trunk/chandler/tools/QAUITestAppLib.py
- trunk/chandler/tools/cats/Functional/TestFlickr.py
- trunk/chandler/tools/cats/framework/ChandlerTestLib.py
Removed Paths
Diff
Modified: trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py (11425 => 11426)
--- trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -66,7 +66,6 @@ "TestRemoveFromTrashOnImport.py", "TestEnableTimezones.py", "TestSwitchTimezone.py", - "TestSubscribe.py", "TestBlocks.py", "TestCleanRepo.py", ] @@ -93,7 +92,6 @@ "TestDates.py", #Chandler not handling daylightsavings bug#5038 "TestEditModeOnEnter.py", #Chandler bug 5744 "TestRemoveFromTrashOnImport.py", #not tested on all platforms yet - "TestSubscribe.py", # new test not yet working ) }
Modified: trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py (11425 => 11426)
--- trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/QATestScripts/Functional/TestFlickr.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -53,22 +53,11 @@ # Add the channel to the sidebar app_ns().sidebarCollection.add(fc) - def sidebarCollectionNamed(name): - """ - Look for a sidebar collection with name, otherwise return False - """ - sidebarWidget = app_ns().sidebar.widget - for i in range(sidebarWidget.GetNumberRows()): - collection = sidebarWidget.GetTable().GetValue(i,0)[0] - if collection.displayName == name: - return collection - return False - # force sidebar to update User.idle() # check results - col = sidebarCollectionNamed(uw("oscon2005")) + col = QAUITestAppLib.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/TestSharing.py (11425 => 11426)
--- trunk/chandler/tools/QATestScripts/Functional/TestSharing.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/QATestScripts/Functional/TestSharing.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -13,89 +13,13 @@ # limitations under the License. import tools.QAUITestAppLib as QAUITestAppLib -import os, sys -from application.dialogs.PublishCollection import ShowPublishDialog -import wx -from i18n import ChandlerMessageFactory as _ -from osaf.sharing import Sharing, unpublish -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() - # initialization fileName = "TestSharing.log" logger = QAUITestAppLib.QALogger(fileName, "TestSharing") try: - # action - # Webdav Account Setting - ap = QAUITestAppLib.UITestAccounts(logger) - ap.Open() # first, open the accounts dialog window - ap.CreateAccount("WebDAV") - ap.TypeValue("displayName", uw("Sharing Test WebDAV")) - ap.TypeValue("host", "qacosmo.osafoundation.org") - ap.TypeValue("path", "cosmo/home/demo1") - ap.TypeValue("username", "demo1") - ap.TypeValue("password", "ad3leib5") - ap.TypeValue("port", "8080") - ap.ToggleValue("ssl", False) - ap.ToggleValue("default", True) - ap.Ok() - - # verification - ap.VerifyValues("WebDAV", 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) - - collection = share.get() - App_ns.sidebarCollection.add(collection) - User.idle() - - # Collection selection - sidebar = App_ns.sidebar - QAUITestAppLib.scripting.User.emulate_sidebarClick(sidebar, "testSharing") - - # Sharing dialog - collection = Block.findBlockByName("MainView").getSidebarSelectedCollection() - if collection is not None: - if sidebar.filterKind is None: - filterClassName = None - else: - klass = sidebar.filterKind.classes['python'] - filterClassName = "%s.%s" % (klass.__module__, klass.__name__) - win = ShowPublishDialog(wx.GetApp().mainFrame, view=App_ns.itsView, - collection=collection, - filterClassName=filterClassName, - modal=False) - #Share button call - win.PublishCollection() - - while not win.done: - wx.GetApp().Yield() - - if not win.success: - logger.ReportFailure("(On publish collection)") - - #Done button call - win.OnPublishDone(None) - wx.GetApp().Yield() - logger.SetChecked(True) - - # cleanup - # cosmo can only handle so many shared calendars - # 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) - + QAUITestAppLib.publishSubscribe(logger) finally: # cleaning logger.Report('Sharing')
Deleted: trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py (11425 => 11426)
--- trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/QATestScripts/Functional/TestSubscribe.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -1,67 +0,0 @@ -# Copyright (c) 2003-2006 Open Source Applications Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import tools.QAUITestAppLib as QAUITestAppLib -import os -import application.dialogs.SubscribeCollection as SubscribeCollection -import wx -from i18n.tests import uw - -App_ns = app_ns() - -#initialization -fileName = "TestSubscribe.log" -logger = QAUITestAppLib.QALogger(fileName, "TestSubscribe") - -try: - # action - # Webdav Account Setting - ap = QAUITestAppLib.UITestAccounts(logger) - ap.Open() # first, open the accounts dialog window - ap.CreateAccount("WebDAV") - displayName = uw("Subscribe Test WebDAV") - ap.TypeValue("displayName", displayName) - ap.TypeValue("host", "qacosmo.osafoundation.org") - ap.TypeValue("path", "home/demo1") - ap.TypeValue("username", "demo1") - ap.TypeValue("password", "ad3leib5") - ap.TypeValue("port", "8080") - ap.ToggleValue("ssl", False) - ap.ToggleValue("default", True) - ap.Ok() - - # verification - ap.VerifyValues("WebDAV", displayName, host = "qacosmo.osafoundation.org", path = "home/demo1", username = "demo1", password="ad3leib5", port=8080) - - # Subscribe dialog - window = SubscribeCollection.Show(wx.GetApp().mainFrame, - view=App_ns.itsView, modal=False) - url = "" - url.SetFocus() - url.Clear() - QAUITestAppLib.scripting.User.emulate_typing("http://qacosmo.osafoundation.org:8080/home/demo1/importTest-1?ticket=g0kplikch1") - window.OnSubscribe(None) - User.idle() - - # verification - if QAUITestAppLib.scripting.User.emulate_sidebarClick(App_ns.sidebar, "importTest"): - logger.ReportPass("(On Subscribe collection)") - else: - logger.ReportFailure("(On Subscribe collection)") - logger.SetChecked(True) - -finally: - #cleaning - logger.Report("Subscribe") - logger.Close()
Modified: trunk/chandler/tools/QATestScripts/Performance/PerfLargeDataSharing.py (11425 => 11426)
--- trunk/chandler/tools/QATestScripts/Performance/PerfLargeDataSharing.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/QATestScripts/Performance/PerfLargeDataSharing.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -13,161 +13,13 @@ # limitations under the License. import tools.QAUITestAppLib as QAUITestAppLib -import os -from application.dialogs.PublishCollection import ShowPublishDialog -import application.dialogs.SubscribeCollection as SubscribeCollection -import wx -from i18n import ChandlerMessageFactory as _ -from osaf.sharing import Sharing, unpublish -from osaf import sharing -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() - - -def sidebarCollectionNamed(name): - """ - Look for a sidebar collection with name, otherwise return None - """ - sidebarWidget = app_ns().sidebar.widget - for i in range(sidebarWidget.GetNumberRows()): - collection = sidebarWidget.GetTable().GetValue(i,0)[0] - if collection.displayName == name: - return collection - return None - # initialization fileName = "PerfLargeDataSharing.log" logger = QAUITestAppLib.QALogger(fileName, "PerfLargeDataSharing") try: - # action - # Webdav Account Setting - ap = QAUITestAppLib.UITestAccounts(logger) - ap.Open() # first, open the accounts dialog window - ap.CreateAccount("WebDAV") - ap.TypeValue("displayName", uw("Publish Test WebDAV")) - ap.TypeValue("host", "qacosmo.osafoundation.org") - ap.TypeValue("path", "cosmo/home/demo1") - ap.TypeValue("username", "demo1") - ap.TypeValue("password", "ad3leib5") - ap.TypeValue("port", "8080") - ap.ToggleValue("ssl", False) - ap.ToggleValue("default", True) - ap.Ok() - - # verification - ap.VerifyValues("WebDAV", uw("Publish 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, 'utf8') - share = Sharing.OneTimeFileSystemShare(path, u'testSharing.ics', ICalendar.ICalendarFormat, itsView=App_ns.itsView) - - collection = share.get() - App_ns.sidebarCollection.add(collection) - User.idle() - - # Collection selection - sidebar = App_ns.sidebar - QAUITestAppLib.scripting.User.emulate_sidebarClick(sidebar, "testSharing") - - # Sharing dialog - collection = Block.findBlockByName("MainView").getSidebarSelectedCollection() - if collection is not None: - if sidebar.filterKind is None: - filterClassName = None - else: - klass = sidebar.filterKind.classes['python'] - filterClassName = "%s.%s" % (klass.__module__, klass.__name__) - win = ShowPublishDialog(wx.GetApp().mainFrame, view=App_ns.itsView, - collection=collection, - filterClassName=filterClassName, - modal=False) - #Share button call - - app = wx.GetApp() - - # We are interested in seeing how quickly we can upload the collection - logger.Start('Publish') - win.PublishCollection() - while not win.done: - app.Yield() - logger.Stop() - - if not win.success: - logger.ReportFailure("(On publish collection)") - - # Get a read-write ticket to the published collection - # XXX This is ripped from PublishCollection - if win.publishType == 'freebusy': - share = sharing.getFreeBusyShare(win.collection) - else: - share = sharing.getShare(win.collection) - urls = sharing.getUrls(share) - if len(urls) == 1: - urlString = urls[0] - elif win.publishType == 'freebusy': - urlString = urls[1] - else: - urlString = urls[0] # read-write - - #Done button call - win.OnPublishDone(None) - app.Yield() - - # Unsubscribe and delete the (local) collection we just published so - # that we can subscribe to it below. - sharing.unsubscribe(collection) - collection.delete(recursive=True) - User.idle() - - # Subscribe to the remote collection - win = SubscribeCollection.Show(wx.GetApp().mainFrame, - view=App_ns.itsView, modal=False) - url = "" - url.SetFocus() - url.Clear() - - # Need to have this or first letter of URL is not - # typed into control on Linux - User.idle() - - QAUITestAppLib.scripting.User.emulate_typing(urlString) - - # We are interested in seeing how quickly we can download the collection - logger.Start('Subscribe') - win.OnSubscribe(None) - try: - while win.subscribing: - app.Yield() - except wx.PyDeadObjectError: - # XXX The C++ part of the dialog was gone, so we are no longer - # XXX supposed to touch any attributes of the dialog. In our - # XXX case this is safe, so just ignore. This seems to be needed - # XXX on Linux only. - pass - logger.Stop() - - User.idle() - - # verification - if QAUITestAppLib.scripting.User.emulate_sidebarClick(App_ns.sidebar, "testSharing"): - # cleanup - # cosmo can only handle so many shared calendars - # so remove this one when done - unpublish(sidebarCollectionNamed('testSharing')) - - logger.ReportPass("(On Subscribe collection)") - else: - logger.ReportFailure("(On Subscribe collection)") - - logger.SetChecked(True) + QAUITestAppLib.publishSubscribe(logger) finally: # cleaning logger.Report('Sharing')
Modified: trunk/chandler/tools/QAUITestAppLib.py (11425 => 11426)
--- trunk/chandler/tools/QAUITestAppLib.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/QAUITestAppLib.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -28,11 +28,159 @@ import osaf.sharing.ICalendar as ICalendar import os, sys from itertools import chain +from i18n.tests import uw +from osaf.sharing import Sharing, unpublish +from osaf.framework.blocks.Block import Block +from application.dialogs.PublishCollection import ShowPublishDialog +import application.dialogs.SubscribeCollection as SubscribeCollection +from osaf import sharing #Global AppProxy instance App_ns = scripting.app_ns() - +def sidebarCollectionNamed(name): + """ + Look for a sidebar collection with name, otherwise return None + """ + sidebarWidget = App_ns.sidebar.widget + for i in range(sidebarWidget.GetNumberRows()): + collection = sidebarWidget.GetTable().GetValue(i,0)[0] + if collection.displayName == name: + return collection + return None + + +def publishSubscribe(logger): + """ + A function to publish and subscribe a collection. + """ + # action + # Webdav Account Setting + ap = UITestAccounts(logger) + ap.Open() # first, open the accounts dialog window + ap.CreateAccount("WebDAV") + ap.TypeValue("displayName", uw("Publish Test WebDAV")) + ap.TypeValue("host", "qacosmo.osafoundation.org") + ap.TypeValue("path", "cosmo/home/demo1") + ap.TypeValue("username", "demo1") + ap.TypeValue("password", "ad3leib5") + ap.TypeValue("port", "8080") + ap.ToggleValue("ssl", False) + ap.ToggleValue("default", True) + ap.Ok() + + # verification + ap.VerifyValues("WebDAV", uw("Publish Test WebDAV"), displayName = uw("Publish 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, 'utf8') + share = Sharing.OneTimeFileSystemShare(path, u'testSharing.ics', ICalendar.ICalendarFormat, itsView=App_ns.itsView) + + collection = share.get() + App_ns.sidebarCollection.add(collection) + scripting.User.idle() + + # Collection selection + sidebar = App_ns.sidebar + scripting.User.emulate_sidebarClick(sidebar, "testSharing") + + # Sharing dialog + collection = Block.findBlockByName("MainView").getSidebarSelectedCollection() + if collection is not None: + if sidebar.filterKind is None: + filterClassName = None + else: + klass = sidebar.filterKind.classes['python'] + filterClassName = "%s.%s" % (klass.__module__, klass.__name__) + win = ShowPublishDialog(wx.GetApp().mainFrame, view=App_ns.itsView, + collection=collection, + filterClassName=filterClassName, + modal=False) + #Share button call + + app = wx.GetApp() + + # We are interested in seeing how quickly we can upload the collection + logger.Start('Publish') + win.PublishCollection() + while not win.done: + app.Yield() + logger.Stop() + + if not win.success: + logger.ReportFailure("(On publish collection)") + + # Get a read-write ticket to the published collection + # XXX This is ripped from PublishCollection + if win.publishType == 'freebusy': + share = sharing.getFreeBusyShare(win.collection) + else: + share = sharing.getShare(win.collection) + urls = sharing.getUrls(share) + if len(urls) == 1: + urlString = urls[0] + elif win.publishType == 'freebusy': + urlString = urls[1] + else: + urlString = urls[0] # read-write + + #Done button call + win.OnPublishDone(None) + app.Yield() + + # Unsubscribe and delete the (local) collection we just published so + # that we can subscribe to it below. + sharing.unsubscribe(collection) + collection.delete(recursive=True) + scripting.User.idle() + + # Subscribe to the remote collection + win = SubscribeCollection.Show(wx.GetApp().mainFrame, + view=App_ns.itsView, modal=False) + url = "" + url.SetFocus() + url.Clear() + + # Need to have this or first letter of URL is not + # typed into control on Linux + scripting.User.idle() + + scripting.User.emulate_typing(urlString) + + # We are interested in seeing how quickly we can download the collection + logger.Start('Subscribe') + win.OnSubscribe(None) + try: + while win.subscribing: + app.Yield() + except wx.PyDeadObjectError: + # XXX The C++ part of the dialog was gone, so we are no longer + # XXX supposed to touch any attributes of the dialog. In our + # XXX case this is safe, so just ignore. This seems to be needed + # XXX on Linux only. + pass + logger.Stop() + + scripting.User.idle() + + # verification + if scripting.User.emulate_sidebarClick(App_ns.sidebar, "testSharing"): + # cleanup + # cosmo can only handle so many shared calendars + # so remove this one when done + collection = sidebarCollectionNamed('testSharing') + unpublish(collection) + collection.delete(recursive=True) + + logger.ReportPass("(On Subscribe collection)") + else: + logger.ReportFailure("(On Subscribe collection)") + + logger.SetChecked(True) + + def getTime(date): """ Return a string representation in 24h format of the time corresponding to the given date
Modified: trunk/chandler/tools/cats/Functional/TestFlickr.py (11425 => 11426)
--- trunk/chandler/tools/cats/Functional/TestFlickr.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/cats/Functional/TestFlickr.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -52,22 +52,11 @@ # Add the channel to the sidebar self.app_ns.sidebarCollection.add(fc) - def sidebarCollectionNamed(name): - """ - Look for a sidebar collection with name, otherwise return False - """ - sidebarWidget = self.app_ns.sidebar.widget - for i in range(sidebarWidget.GetNumberRows()): - collection = sidebarWidget.GetTable().GetValue(i,0)[0] - if collection.displayName == name: - return collection - return False - # force sidebar to update self.scripting.User.idle() # check results - col = sidebarCollectionNamed(uw("oscon2005")) + col = QAUITestAppLib.sidebarCollectionNamed(uw("oscon2005")) if not col: self.logger.endAction(False, "Flickr Collection wasn't created") if col and len(col) != 10:
Deleted: trunk/chandler/tools/cats/Functional/TestSubscribe.py (11425 => 11426)
--- trunk/chandler/tools/cats/Functional/TestSubscribe.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/cats/Functional/TestSubscribe.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -1,64 +0,0 @@ -# Copyright (c) 2003-2006 Open Source Applications Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import tools.cats.framework.ChandlerTestLib as QAUITestAppLib -from tools.cats.framework.ChandlerTestCase import ChandlerTestCase -import os -import application.dialogs.SubscribeCollection as SubscribeCollection -import wx -from i18n.tests import uw -import osaf.framework.scripting as scripting - - -class TestSubscribing(ChandlerTestCase): - - def startTest(self): - - # action - # Webdav Account Setting - ap = QAUITestAppLib.UITestAccounts(self.logger) - ap.Open() # first, open the accounts dialog window - ap.CreateAccount("WebDAV") - ap.TypeValue("displayName", uw("Subscribe Test WebDAV")) - ap.TypeValue("host", "qacosmo.osafoundation.org") - ap.TypeValue("path", "home/demo1") - ap.TypeValue("username", "demo1") - ap.TypeValue("password", "ad3leib5") - ap.TypeValue("port", "8080") - ap.ToggleValue("ssl", False) - ap.ToggleValue("default", True) - ap.Ok() - self.logger.endAction(True) - - # verification - ap.VerifyValues("WebDAV", uw("Subscribe Test WebDAV"), host = "qacosmo.osafoundation.org", path = "home/demo1", username = "demo1", password="ad3leib5", port=8080) - - # Subscribe dialog - self.logger.startAction("Subscribe dialog") - window = SubscribeCollection.Show(wx.GetApp().mainFrame, - view=self.app_ns.itsView, modal=False) - url = "" - url.SetFocus() - url.Clear() - QAUITestAppLib.scripting.User.emulate_typing("http://qacosmo.osafoundation.org:8080/home/demo1/importTest-1?ticket=g0kplikch1") - window.OnSubscribe(None) - scripting.User.idle() - - # verification - if QAUITestAppLib.scripting.User.emulate_sidebarClick(App_ns.sidebar, "importTest"): - self.logger.endAction(True, "(On Subscribe collection)") - else: - self.logger.endAction(False, "(On Subscribe collection)") - -
Modified: trunk/chandler/tools/cats/framework/ChandlerTestLib.py (11425 => 11426)
--- trunk/chandler/tools/cats/framework/ChandlerTestLib.py 2006-08-16 21:29:48 UTC (rev 11425) +++ trunk/chandler/tools/cats/framework/ChandlerTestLib.py 2006-08-16 22:46:04 UTC (rev 11426) @@ -34,11 +34,159 @@ import osaf.sharing.ICalendar as ICalendar import os, sys from itertools import chain +from i18n.tests import uw +from osaf.sharing import Sharing, unpublish +from osaf.framework.blocks.Block import Block +from application.dialogs.PublishCollection import ShowPublishDialog +import application.dialogs.SubscribeCollection as SubscribeCollection +from osaf import sharing #Global AppProxy instance App_ns = scripting.app_ns() - +def sidebarCollectionNamed(name): + """ + Look for a sidebar collection with name, otherwise return None + """ + sidebarWidget = App_ns.sidebar.widget + for i in range(sidebarWidget.GetNumberRows()): + collection = sidebarWidget.GetTable().GetValue(i,0)[0] + if collection.displayName == name: + return collection + return None + + +def publishSubscribe(logger): + """ + A function to publish and subscribe a collection. + """ + # action + # Webdav Account Setting + ap = UITestAccounts(logger) + ap.Open() # first, open the accounts dialog window + ap.CreateAccount("WebDAV") + ap.TypeValue("displayName", uw("Publish Test WebDAV")) + ap.TypeValue("host", "qacosmo.osafoundation.org") + ap.TypeValue("path", "cosmo/home/demo1") + ap.TypeValue("username", "demo1") + ap.TypeValue("password", "ad3leib5") + ap.TypeValue("port", "8080") + ap.ToggleValue("ssl", False) + ap.ToggleValue("default", True) + ap.Ok() + + # verification + ap.VerifyValues("WebDAV", uw("Publish Test WebDAV"), displayName = uw("Publish 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, 'utf8') + share = Sharing.OneTimeFileSystemShare(path, u'testSharing.ics', ICalendar.ICalendarFormat, itsView=App_ns.itsView) + + collection = share.get() + App_ns.sidebarCollection.add(collection) + scripting.User.idle() + + # Collection selection + sidebar = App_ns.sidebar + scripting.User.emulate_sidebarClick(sidebar, "testSharing") + + # Sharing dialog + collection = Block.findBlockByName("MainView").getSidebarSelectedCollection() + if collection is not None: + if sidebar.filterKind is None: + filterClassName = None + else: + klass = sidebar.filterKind.classes['python'] + filterClassName = "%s.%s" % (klass.__module__, klass.__name__) + win = ShowPublishDialog(wx.GetApp().mainFrame, view=App_ns.itsView, + collection=collection, + filterClassName=filterClassName, + modal=False) + #Share button call + + app = wx.GetApp() + + # We are interested in seeing how quickly we can upload the collection + logger.Start('Publish') + win.PublishCollection() + while not win.done: + app.Yield() + logger.Stop() + + if not win.success: + logger.ReportFailure("(On publish collection)") + + # Get a read-write ticket to the published collection + # XXX This is ripped from PublishCollection + if win.publishType == 'freebusy': + share = sharing.getFreeBusyShare(win.collection) + else: + share = sharing.getShare(win.collection) + urls = sharing.getUrls(share) + if len(urls) == 1: + urlString = urls[0] + elif win.publishType == 'freebusy': + urlString = urls[1] + else: + urlString = urls[0] # read-write + + #Done button call + win.OnPublishDone(None) + app.Yield() + + # Unsubscribe and delete the (local) collection we just published so + # that we can subscribe to it below. + sharing.unsubscribe(collection) + collection.delete(recursive=True) + scripting.User.idle() + + # Subscribe to the remote collection + win = SubscribeCollection.Show(wx.GetApp().mainFrame, + view=App_ns.itsView, modal=False) + url = "" + url.SetFocus() + url.Clear() + + # Need to have this or first letter of URL is not + # typed into control on Linux + scripting.User.idle() + + scripting.User.emulate_typing(urlString) + + # We are interested in seeing how quickly we can download the collection + logger.Start('Subscribe') + win.OnSubscribe(None) + try: + while win.subscribing: + app.Yield() + except wx.PyDeadObjectError: + # XXX The C++ part of the dialog was gone, so we are no longer + # XXX supposed to touch any attributes of the dialog. In our + # XXX case this is safe, so just ignore. This seems to be needed + # XXX on Linux only. + pass + logger.Stop() + + scripting.User.idle() + + # verification + if scripting.User.emulate_sidebarClick(App_ns.sidebar, "testSharing"): + # cleanup + # cosmo can only handle so many shared calendars + # so remove this one when done + collection = sidebarCollectionNamed('testSharing') + unpublish(collection) + collection.delete(recursive=True) + + logger.ReportPass("(On Subscribe collection)") + else: + logger.ReportFailure("(On Subscribe collection)") + + logger.SetChecked(True) + + def getTime(date): """ Return a string representation in 24h format of the time corresponding to the given date
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
