def test_suite(): from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite, installProduct from pprint import pprint from zope.interface import alsoProvides setup.setupPloneSite() globs = locals() setup = dtf.ZopeDocFileSuite("setup.txt", optionflags=optionflags, package='opencore.nui', test_class=OpenPlansTestCase, globs = globs, setUp=simple_setup, layer=test_layer ) email_sender = dtf.ZopeDocFileSuite("email-sender.txt", optionflags=optionflags, package='opencore.nui', test_class=OpenPlansTestCase, globs = globs, setUp=simple_setup, layer=test_layer ) return unittest.TestSuite((email_sender, setup))
def test_suite(): from Products.CMFCore.utils import getToolByName from Products.Five.utilities.marker import erase as noLongerProvides from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import installProduct from opencore.interfaces.workflow import IReadWorkflowPolicySupport from opencore.listen.featurelet import ListenFeaturelet from opencore.nui.indexing import authenticated_memberid from opencore.testing import utils from pprint import pprint from topp.featurelets.interfaces import IFeatureletSupporter from zope.component import getUtility from zope.interface import alsoProvides import pdb setup.setupPloneSite() def readme_setup(tc): oc_setup.fresh_skin(tc) setSite(tc.portal) setHooks() globs = locals() readme = dtf.ZopeDocFileSuite("README.txt", optionflags=optionflags, package='opencore.feed.browser', test_class=FunctionalTestCase, globs = globs, setUp=readme_setup, layer = OpencoreContent ) return unittest.TestSuite((readme,))
def test_suite(): import pdb from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite, installProduct from opencore.testing import noLongerProvides from pprint import pprint from zope.component import getMultiAdapter, getUtility from zope.interface import alsoProvides import transaction as txn from interfaces import IClockQueue setup.setupPloneSite() def base_setup(tc): readme_setup(tc) tc._refreshSkinData() tc.request = tc.app.REQUEST tc.response = tc.request.RESPONSE tc.homepage = getattr(tc.portal, 'site-home') tc.projects = tc.portal.projects globs = locals() clockq = FunctionalDocFileSuite("clock-queue.txt", optionflags=optionflags, package='sputnik', test_class=OpenPlansTestCase, globs = globs, setUp=base_setup ) clockq.layer = OpenPlansLayer return unittest.TestSuite((delete, clockq))
def test_suite(): from Products.PloneTestCase import setup from opencore.project.browser.base import ProjectBaseView from opencore.member.browser.view import ProfileView from pprint import pprint from Products.PleiadesGeocoder.interfaces import IGeoItemSimple, IGeoFolder,\ IGeoreferenceable, IGeoAnnotatableContent, IGeoserializable, \ IGeoserializableMembersFolder from opencore.geotagging.interfaces import IReadGeo, IWriteGeo, IReadWriteGeo ZopeTestCase.installProduct('PleiadesGeocoder') setup.setupPloneSite() globs = locals() config = dtf.ZopeDocFileSuite('configuration.txt', optionflags=optionflags, package='opencore.geotagging', test_class=OpenPlansTestCase, globs=globs, setUp=hook_setup, layer=test_layer ) utilsunit = doctest.DocTestSuite('opencore.geotagging.utils', optionflags=optionflags) return unittest.TestSuite((utilsunit, config, ))
def test_suite(): from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite, installProduct from pprint import pprint from zope.interface import alsoProvides from pprint import pprint from opencore.browser.base import BaseView from opencore.i18n import _ from opencore.testing import utils import os setup.setupPloneSite() def readme_setup(tc): # XXX duplicates simple_setup? tc._refreshSkinData() tc.request = tc.app.REQUEST tc.response = tc.request.RESPONSE tc.homepage = getattr(tc.portal, 'site-home') tc.projects = tc.portal.projects setSite(tc.portal) def teardown(tc): utils.unmonkey_proj_noun() def errors_teardown(tc): import os try: del os.environ['SUPERVISOR_ENABLED'] except KeyError: pass globs = locals() readme = dtf.ZopeDocFileSuite("README.txt", optionflags=optionflags, package='opencore.browser', test_class=OpenPlansTestCase, globs = globs, setUp=readme_setup, tearDown=teardown, layer = test_layer ) errors = dtf.ZopeDocFileSuite("error.txt", optionflags=optionflags, package='opencore.browser', test_class=OpenPlansTestCase, globs = globs, setUp=readme_setup, tearDown=errors_teardown, layer = test_layer ) return unittest.TestSuite((readme, formhandler.test_suite(), tal.test_suite(), window_title.test_suite(), errors, ))
def test_suite(): from Products.PloneTestCase import ptc, setup from Testing.ZopeTestCase import FunctionalDocFileSuite, installProduct from pprint import pprint from zope.interface import alsoProvides from opencore.testing.utils import clear_status_messages from opencore.testing.utils import get_status_messages from opencore.utility.interfaces import IProvideSiteConfig from opencore.interfaces.membership import IEmailInvites from opencore.interfaces.member import IMemberHomePage, IMemberFolder from opencore.member.interfaces import IHandleMemberWorkflow from zope.app.component.hooks import setSite, setHooks from zope.component import getUtility from pprint import pprint fired = [] setup.setupPloneSite() globs = locals() globs.update({'StubMemberWorkflow': StubMemberWorkflow, 'normalize_whitespace': normalize_whitespace, 'stub_getUserById': stub_getUserById}) account = dtf.ZopeDocTestSuite("opencore.account.tests.account", optionflags=optionflags, test_class=OpenPlansTestCase, globs = globs, setUp=readme_setup, layer=OpencoreContent ) invite = dtf.ZopeDocTestSuite("opencore.account.tests.invite_join", optionflags=optionflags, test_class=OpenPlansTestCase, globs = globs, setUp=readme_setup, layer=OpencoreContent ) confirm = dtf.ZopeDocTestSuite("opencore.account.tests.confirm", optionflags=optionflags, test_class=ptc.PloneTestCase, globs=globs, setUp=readme_setup, layer=OpencoreContent, ) first_login = dtf.ZopeDocTestSuite("opencore.account.tests.first_login", optionflags=optionflags, test_class=ptc.PloneTestCase, globs = globs, setUp=readme_setup, layer = OpencoreContent ) return unittest.TestSuite((account, invite, confirm, first_login))
def test_suite(): from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite, installProduct from pprint import pprint from zope.interface import alsoProvides from pprint import pprint from opencore.browser.formhandler import test_suite as octotest from opencore.testing.utils import monkey_proj_noun, unmonkey_proj_noun from zope.component import getUtility from Products.listen.interfaces import IListLookup setup.setupPloneSite() def set_site(tc): setSite(tc.portal) setHooks() def listen_discussion_setup(tc): tc._refreshSkinData() tc.request = tc.app.REQUEST tc.response = tc.request.RESPONSE tc.homepage = getattr(tc.portal, 'site-home') tc.projects = tc.portal.projects set_site(tc) def listen_featurelet_setup(tc): set_site(tc) def teardown(tc): unmonkey_proj_noun() globs = locals() listen_discussion = FunctionalDocFileSuite("listen_discussion.txt", optionflags=optionflags, package='opencore.listen', test_class=OpenPlansTestCase, globs = globs, setUp=listen_discussion_setup, tearDown=teardown, ) listen_featurelet = FunctionalDocFileSuite("listen_featurelet.txt", optionflags=optionflags, package='opencore.listen', test_class=OpenPlansTestCase, globs = globs, setUp=listen_featurelet_setup, ) listen_discussion.layer = listen_featurelet.layer = test_layer suite = unittest.TestSuite((listen_discussion, listen_featurelet)) from test_manage_event import TestMailingListManageEvent suite.addTest(unittest.makeSuite(TestMailingListManageEvent)) return suite
def test_suite(): from Products.CMFCore.utils import getToolByName from Products.Five.utilities.marker import erase as noLongerProvides from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import installProduct from opencore.geotagging.browser import viewlets from opencore import geotagging from opencore.testing import utils from pprint import pprint from zope.component import getUtility from zope.interface import alsoProvides, verify from Products.PleiadesGeocoder.interfaces import IGeoItemSimple from opencore.utility.interfaces import IProvideSiteConfig import pdb installProduct('PleiadesGeocoder') # Don't need to do setupPloneSite(products=['PleiadesGeocoder']) because # we'll use a mock instead. setup.setupPloneSite() project_name = 'p3' project_admin = 'm1' member = 'm2' def get_response_output(view): """quick hack to be able to test output of views that call response.write or otherwise don't just return string data. Note that you get HTTP headers as well as the body - but ONLY on the first call in a doctest - I think because the request & response objects are re-used? This sucks, but I don't know how to hack around it right now, except to expect this in tests... """ from cStringIO import StringIO response = view.request.RESPONSE response.stdout = StringIO() view() return response.stdout.getvalue() globs = locals() readme = dtf.FunctionalDocFileSuite( "README.txt", optionflags=optionflags, package='opencore.geotagging.browser', test_class=FunctionalTestCase, globs = globs, setUp=readme_setup, tearDown=readme_teardown, layer = test_layer ) suites = (readme, ) return unittest.TestSuite(suites)
def test_suite(): from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from pprint import pprint # imported because its passed via globs = locals() setup.setupPloneSite() def readme_setup(tc): tc._refreshSkinData() setSite(tc.portal) page_id = 'project-home' globs = locals() readme = dtfactory.ZopeDocFileSuite("README.txt", optionflags=optionflags, package='opencore.nui.wiki', test_class=FunctionalTestCase, globs = globs, setUp=readme_setup, layer = OpencoreContent ) wikiadd = dtfactory.ZopeDocFileSuite("add.txt", optionflags=optionflags, package='opencore.nui.wiki', test_class=FunctionalTestCase, setUp=readme_setup, globs = globs, layer = OpencoreContent, ) history = dtfactory.ZopeDocFileSuite("history.txt", optionflags=optionflags, package='opencore.nui.wiki', test_class=FunctionalTestCase, setUp=readme_setup, globs = globs, layer = OpencoreContent ) htmldiff2 = doctest.DocFileSuite('test_htmldiff2.txt') return unittest.TestSuite((wikiadd, readme, history, htmldiff2, unittest.makeSuite(UnescapeTests)))
def test_suite(): from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from pprint import pprint from opencore.testing import utils from zope.interface import alsoProvides setup.setupPloneSite() globs = locals() def setup(tc): catalog = tc.portal.portal_catalog for idx in 'created', 'modified': replace_datetimeidx(idx, catalog) def setup_search(tc): setup(tc) setSite(tc.portal) setHooks() def teardown_search(tc): # search leaves a mailing list as the site setSite(tc.portal) search = dtfactory.ZopeDocFileSuite("search.txt", optionflags=optionflags, package='opencore.nui.main', test_class=FunctionalTestCase, setUp=setup_search, tearDown=teardown_search, globs=globs, layer=OpencoreContent ) contact = dtfactory.ZopeDocFileSuite("contact.txt", optionflags=optionflags, package='opencore.nui.main', test_class=FunctionalTestCase, globs=globs, layer=OpenPlansLayer ) return unittest.TestSuite((search, contact))
def test_suite(): from Products.PloneTestCase import setup from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite, installProduct from opencore import redirect from opencore.interfaces.event import AfterProjectAddedEvent, AfterSubProjectAddedEvent from Products.OpenPlans.Extensions.create_test_content import create_test_content from pprint import pprint from zope.interface import alsoProvides setup.setupPloneSite() def hook_setup(tc): tc._refreshSkinData() #enableLocalSiteHook(tc.portal) setSite(tc.portal) setHooks() globs = locals() readme = dtf.ZopeDocFileSuite("README.txt", optionflags=optionflags, package='opencore.project', test_class=OpenPlansTestCase, globs = globs, setUp=hook_setup, layer=test_layer ) placeful_workflow = dtf.ZopeDocFileSuite("placeful_workflow_test.txt", optionflags=optionflags, package='opencore.nui', test_class=OpenPlansTestCase, globs = globs, setUp=simple_setup, layer=test_layer ) return unittest.TestSuite((readme, wftest()))
def test_suite(): from Products.CMFCore.utils import getToolByName from Products.PloneTestCase import setup from Products.listen.interfaces import IListLookup from Testing.ZopeTestCase import installProduct from opencore.interfaces.workflow import IReadWorkflowPolicySupport from opencore.listen.featurelet import ListenFeaturelet from opencore.nui.indexing import authenticated_memberid # for delete-project from opencore.testing import utils from opencore.testing.utils import clear_status_messages from opencore.testing.utils import get_status_messages from pprint import pprint from opencore.listen.featurelet import ListenFeaturelet # for delete-project from topp.featurelets.interfaces import IFeatureletSupporter from zope.component import getUtility from zope.interface import alsoProvides setup.setupPloneSite() def contents_content(tc): tc.loginAsPortalOwner() proj = tc.portal.projects.p2 proj.invokeFactory('Document', 'new1', title='new title') proj.invokeFactory('Image', 'img1', title='new image') proj.restrictedTraverse('project-home').invokeFactory('FileAttachment', 'fa1', title='new file') proj.new1.invokeFactory('FileAttachment', 'fa2', title='new1 file') proj.invokeFactory('Folder', 'lists', title='Listen Stub') lists = proj.lists lists.setLayout('mailing_lists') alsoProvides(lists, IListenContainer) setSite(tc.portal) setHooks() proj.lists.invokeFactory('Open Mailing List', 'list1', title=u'new list') def metadata_setup(tc): tc.project = tc.portal.projects.p1 tc.page = getattr(tc.project, 'project-home') def readme_setup(tc): oc_setup.fresh_skin(tc) setSite(tc.portal) setHooks() test_file = pkgr.resource_stream(OC_REQ, 'opencore/project/browser/test.png') globs = locals() readme = dtf.ZopeDocFileSuite("README.txt", optionflags=optionflags, package='opencore.project.browser', test_class=FunctionalTestCase, globs = globs, setUp=readme_setup, layer = OpencoreContent, ) team_view = dtf.ZopeDocFileSuite("team-view.txt", optionflags=optionflags, package='opencore.project.browser', test_class=FunctionalTestCase, globs = globs, setUp=readme_setup, layer = OpencoreContent, ) logo = dtf.FunctionalDocFileSuite("logo.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs=globs, setUp=readme_setup, layer=OpencoreContent ) delete = dtf.ZopeDocFileSuite("delete-project.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs=globs, setUp=readme_setup, layer=OpencoreContent ) metadata = dtf.ZopeDocFileSuite("metadata.txt", optionflags=optionflags, package='opencore.project.browser', test_class=FunctionalTestCase, globs = globs, setUp=metadata_setup, layer=OpencoreContent ) contents = dtf.ZopeDocFileSuite("contents.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs = globs, setUp=contents_content, layer=OpencoreContent ) manage_team = dtf.ZopeDocFileSuite("manage-team.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs = globs, setUp=oc_setup.set_portal_as_site, layer=OpencoreContent ) request_membership = dtf.ZopeDocFileSuite("request-membership.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs = globs, setUp=oc_setup.set_portal_as_site, layer=OpencoreContent ) contents = dtf.ZopeDocFileSuite("security_context.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs = globs, setUp=contents_content, layer=OpencoreContent ) homepage = dtf.ZopeDocFileSuite("homepage.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs = globs, setUp=oc_setup.set_portal_as_site, layer=OpencoreContent ) team_request_membership = dtf.FunctionalDocFileSuite("team_membership.txt", optionflags=optionflags, package='opencore.project.browser', test_class=OpenPlansTestCase, globs = globs, setUp=oc_setup.set_portal_as_site, layer=OpencoreContent ) suites = (contents, metadata, manage_team, request_membership, homepage, team_request_membership, logo, readme, delete, team_view, ) return unittest.TestSuite(suites)
from Products.OpenPlans.Extensions.Install import migrateATDocToOpenPage from Testing.ZopeTestCase import PortalTestCase, Zope2, connections, utils, base from ZODB.DemoStorage import DemoStorage import ZODB from Products.PloneTestCase.setup import setupPloneSite from Products.PloneTestCase import five from opencore.testing.layer import PloneSite import transaction as txn from Products.OpenPlans.tests.utils import installConfiguredProducts portal_name = 'o1' extension_profiles=['membrane:default', 'remember:default'] installConfiguredProducts() setupPloneSite(id=portal_name, extension_profiles=extension_profiles) ZopeTestCase.installProduct('OpenPlans') class BasePloneInstallTest(ptc.FunctionalTestCase): layer = PloneSite def afterSetUp(self): self.loginAsPortalOwner() ## setup_tool = self.portal.portal_setup ## setup_tool.setImportContext('profile-membrane:default') ## setup_tool.runAllImportSteps() ## setup_tool.setImportContext('profile-remember:default') ## setup_tool.runAllImportSteps() def getPortal(self):
import unittest from niteoweb.windmill import WindmillTestCase from Products.PloneTestCase.setup import setupPloneSite from Products.PloneTestCase.layer import onsetup from Products.Five.zcml import load_config from Testing import ZopeTestCase as ztc setupPloneSite(products=[]) class IntegrationTestCaseAnon(WindmillTestCase): def afterSetUp(self): """Setup for each test """ ztc.utils.setupCoreSessions(self.app) self.setRoles(['Manager']) self.login_user() def test_login_popup(self): """Check that login form works as popup; if it does, this confirms overlays work for unauth users and that the refresh no-form action works. """ client = self.wm # Log out so that we can test log in client.click(link=u'Log out') client.waits.forPageLoad(timeout=u'20000') client.click(link=u'Home') client.waits.forPageLoad(timeout=u'20000')
import unittest from niteoweb.windmill import WindmillTestCase from Products.PloneTestCase.setup import setupPloneSite from Products.PloneTestCase.layer import onsetup from Products.Five.zcml import load_config from Testing import ZopeTestCase as ztc @onsetup def load_zcml(): import plone.app.themeeditor load_config('configure.zcml', plone.app.themeeditor) ztc.installPackage('plone.app.themeeditor') load_zcml() setupPloneSite(products=['plone.app.themeeditor']) class ThemeEditorIntegrationTestCase(WindmillTestCase): def afterSetUp(self): """Setup for each test """ ztc.utils.setupCoreSessions(self.app) self.setRoles(['Manager']) self.login_user() def test_customize_logo(self): client = self.wm client.click(id=u'user-name') # load customizer client.click(link=u'Site Setup') client.waits.forPageLoad(timeout=u'20000')
from Products.PloneTestCase.setup import setupPloneSite from Products.PloneTestCase.layer import onsetup from Products.Five.zcml import load_config from Testing import ZopeTestCase as ztc from plone.dexterity.utils import createContent @onsetup def load_zcml(): import plone.app.dexterity load_config('configure.zcml', plone.app.dexterity) ztc.installPackage('plone.app.dexterity') load_zcml() #setupPloneSite(products=['plone.app.page']) setupPloneSite(products=['plone.app.dexterity']) class DecoUITestCase(WindmillTestCase): def afterSetUp(self): """Setup for each test """ ztc.utils.setupCoreSessions(self.app) self.setRoles(['Manager']) self.login_user() def test_exporter(self): client = self.wm # Create a new page with the title 'Page'
from zope.site.hooks import setSite from Testing.ZopeTestCase.sandbox import Sandboxed from Products.PloneTestCase.PloneTestCase import PloneTestCase from Products.PloneTestCase.layer import PloneSiteLayer from Products.PloneTestCase.setup import setupPloneSite from Products.CMFCore.interfaces import IActionCategory from Products.CMFCore.interfaces import IActionInfo from Products.CMFCore.utils import getToolByName from Products.CMFCore.tests.base.testcase import WarningInterceptor from Products.GenericSetup.context import TarballImportContext from Products.Five import zcml setupPloneSite(products=["plone.app.folder"]) class MigrationTest(PloneTestCase): def removeActionFromTool(self, action_id, category=None, action_provider='portal_actions'): # Removes an action from portal_actions tool = getToolByName(self.portal, action_provider) if category is None: if action_id in tool.objectIds() and IActionInfo.providedBy(tool._getOb(action_id)): tool._delOb(action_id) else: if category in tool.objectIds() and IActionCategory.providedBy(tool._getOb(category)): if action_id in tool.objectIds() and IActionInfo.providedBy(tool._getOb(action_id)): tool._delOb(action_id) def addResourceToJSTool(self, resource_name):
def test_suite(): from Products.CMFCore.utils import getToolByName from Products.PloneTestCase.PloneTestCase import FunctionalTestCase from Products.PloneTestCase import setup from opencore import redirect from opencore.interfaces.membership import IEmailInvites from opencore.interfaces.message import ITransientMessage from opencore.interfaces.message import ITransientMessage from opencore.interfaces.pending_requests import IPendingRequests from zope.interface import alsoProvides from zope.component import getUtility setup.setupPloneSite() def readme_setup(tc): orig_user = tc.portal.portal_membership.getAuthenticatedMember().getId() tc.loginAsPortalOwner() tc._refreshSkinData() tc.login(orig_user) setSite(tc.portal) globs = locals() readme = dtf.ZopeDocFileSuite( "README.txt", optionflags=optionflags, package="opencore.member", test_class=FunctionalTestCase, globs=globs, setUp=readme_setup, layer=OpencoreContent, ) transient = dtf.ZopeDocFileSuite( "transient-message.txt", optionflags=optionflags, package="opencore.member", test_class=OpenPlansTestCase, globs=globs, ) pending = dtf.ZopeDocFileSuite( "pending_requests.txt", optionflags=optionflags, package="opencore.member", test_class=OpenPlansTestCase, globs=globs, layer=OpencoreContent, ) pending_multi = dtf.ZopeDocFileSuite( "pending_requests_multiadapter.txt", optionflags=optionflags, package="opencore.member", test_class=OpenPlansTestCase, globs=globs, layer=OpencoreContent, ) subscribers = dtf.ZopeDocFileSuite( "subscribers.txt", optionflags=optionflags, package="opencore.member", test_class=OpenPlansTestCase, globs=globs, layer=OpencoreContent, ) return unittest.TestSuite((readme, transient, pending, pending_multi, subscribers))