############################################################################## # # Copyright (c) 2007 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """zope.app.authentication common test related classes/functions/objects. $Id: testing.py 72477 2007-02-09 03:25:38Z baijum $ """ __docformat__ = "reStructuredText" import os from zope.app.testing.functional import ZCMLLayer AppAuthenticationLayer = ZCMLLayer( os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'AppAuthenticationLayer', allow_teardown=True)
import os.path import testedsample from zope.app.testing.functional import ZCMLLayer ftesting_zcml = os.path.join(os.path.dirname(testedsample.__file__), 'ftesting.zcml') FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
############################################################################## # # Copyright (c) 2007 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """zope.app.publisher common test related classes/functions/objects. $Id$ """ __docformat__ = "reStructuredText" import os from zope.app.testing.functional import ZCMLLayer AppPublisherLayer = ZCMLLayer(os.path.join( os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'AppPublisherLayer', allow_teardown=True)
import os import unittest from zope.testing import doctest from zope.app.testing.functional import ZCMLLayer testing_zcml_path = os.path.join(os.path.dirname(__file__), 'testing.zcml') testing_zcml_layer = ZCMLLayer(testing_zcml_path, 'plone.formwidget.captcha', 'testing_zcml_layer') def test_suite(): readme_txt = doctest.DocFileSuite('README.txt') readme_txt.layer = testing_zcml_layer return unittest.TestSuite([ readme_txt, ])
import os.path import z3c.testsetup import uvc.landingpage from zope.app.testing.functional import ZCMLLayer from uvcsite.tests import product_config ftesting_zcml = os.path.join(os.path.dirname(uvc.landingpage.__file__), 'ftesting.zcml') FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer', allow_teardown=True, product_config=product_config) test_suite = z3c.testsetup.register_all_tests('uvc.landingpage', layer=FunctionalLayer)
import os.path import megrok.storm from zope.app.testing.functional import ZCMLLayer ftesting_zcml = os.path.join(os.path.dirname(megrok.storm.__file__), 'ftesting.zcml') FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer', allow_teardown=True)
import os import unittest import testedsample from zope.testing import doctest from zope.app.testing.functional import (FunctionalTestSetup, ZCMLLayer, getRootFolder, FunctionalDocFileSuite) import zope.testbrowser.browser import zope.testbrowser.testing ftesting_zcml = os.path.join(os.path.dirname(testedsample.__file__), 'ftesting.zcml') TestedSampleFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'TestedSampleFunctionalLayer') def test_suite(): suite = unittest.TestSuite() docfiles = ['index.txt'] for docfile in docfiles: test = FunctionalDocFileSuite( docfile, globs=dict(getRootFolder=getRootFolder, Browser=zope.testbrowser.testing.Browser), optionflags=(doctest.ELLIPSIS | doctest.REPORT_NDIFF | doctest.NORMALIZE_WHITESPACE), ) test.layer = TestedSampleFunctionalLayer suite.addTest(test)
import os from zope.app.testing import setup from zope.app.testing.functional import ZCMLLayer from zope.component import provideAdapter from zope.dublincore.interfaces import IWriteZopeDublinCore from zopesandbox.document.interfaces import IDocument from zopesandbox.document.document import DocumentDublinCore DocumentLayer = ZCMLLayer(os.path.join(os.path.dirname(__file__), 'ftesting.zcml'), __name__, 'DocumentLayer') def setUp(test): setup.placefulSetUp() provideAdapter(DocumentDublinCore, (IDocument,), IWriteZopeDublinCore) def tearDown(test): setup.placefulTearDown()
import tempfile import lxml.etree import os from zope.rdb import gadflyda from zope.app.testing.functional import ZCMLLayer def setUp(test): gadfly_dir = tempfile.mkdtemp() os.mkdir(os.path.join(gadfly_dir, 'msg')) gadflyda.setGadflyRoot(gadfly_dir) def printElement(browser, xpath, multiple=False, serialize=True): result = [ serialize and lxml.etree.tounicode(elem) or elem for elem in browser.etree.xpath(xpath) ] if not multiple: print result[0] return for elem in result: print elem FormDemoLayer = ZCMLLayer(os.path.join( os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'MarsFormDemoLayer', allow_teardown=True)
import os import unittest from zope.testing import doctest from zope.app.testing import setup from zope.app.testing.functional import ZCMLLayer from zope.app.testing.functional import FunctionalTestSetup, getRootFolder import tfws.website ftesting_zcml = os.path.join(os.path.dirname(tfws.website.__file__), 'ftesting.zcml') TestLayer = ZCMLLayer(ftesting_zcml, __name__, 'TestLayer') ftest_selenium_zcml = os.path.join(os.path.dirname(tfws.website.__file__), 'ftest-selenium.zcml') SeleniumTestLayer = ZCMLLayer(ftest_selenium_zcml, __name__, 'SeleniumLayer') optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS globs = dict(getRootFolder=getRootFolder) def setUp(test): FunctionalTestSetup().setUp() def tearDown(test): FunctionalTestSetup().tearDown()
import os import unittest import simpleauthtest from zope.testing import doctest from zope.app.testing.functional import (FunctionalTestSetup, ZCMLLayer, getRootFolder, FunctionalDocFileSuite) import zope.testbrowser.browser import zope.testbrowser.testing ftesting_zcml = os.path.join(os.path.dirname(simpleauthtest.__file__), 'ftesting.zcml') SimpleAuthFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'SimpleAuthFunctionalLayer') def test_suite(): suite = unittest.TestSuite() docfiles = ['index.txt',] for docfile in docfiles: test = FunctionalDocFileSuite( docfile, globs=dict(getRootFolder=getRootFolder, Browser=zope.testbrowser.testing.Browser), optionflags = (doctest.ELLIPSIS | doctest.REPORT_NDIFF | doctest.NORMALIZE_WHITESPACE),) test.layer = SimpleAuthFunctionalLayer suite.addTest(test) return suite if __name__ == '__main__': unittest.main()
# FOR A PARTICULAR PURPOSE. # ############################################################################## """ $Id$ """ __docformat__ = "reStructuredText" import os.path import unittest from zope.testing import doctest from zope.app.testing import functional from zope.app.testing.functional import ZCMLLayer memcachedLayer = ZCMLLayer(os.path.join( os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'memcachedLayer', allow_teardown=True) def test_suite(): suite = functional.FunctionalDocFileSuite('README.txt') suite.layer = memcachedLayer suite.level = 2 return unittest.TestSuite((suite, )) if __name__ == '__main__': unittest.main(defaultTest='test_suite')
import os import unittest import plainlogindemo from zope.testing import doctest from zope.app.testing.functional import (FunctionalTestSetup, ZCMLLayer, getRootFolder, FunctionalDocFileSuite) import zope.testbrowser.browser import zope.testbrowser.testing ftesting_zcml = os.path.join(os.path.dirname(plainlogindemo.__file__), 'ftesting.zcml') PlainLoginDemoFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'PlainLoginDemoFunctionalLayer') def test_suite(): suite = unittest.TestSuite() docfiles = ['index.txt', 'join.txt', 'member.txt'] for docfile in docfiles: test = FunctionalDocFileSuite( docfile, globs=dict(getRootFolder=getRootFolder, Browser=zope.testbrowser.testing.Browser), optionflags=(doctest.ELLIPSIS | doctest.REPORT_NDIFF | doctest.NORMALIZE_WHITESPACE), ) test.layer = PlainLoginDemoFunctionalLayer suite.addTest(test)
############################################################################## # # Copyright (c) 2007 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """zope.app.securitypolicy common test related classes/functions/objects. $Id$ """ __docformat__ = "reStructuredText" import os from zope.app.testing.functional import ZCMLLayer SecurityPolicyLayer = ZCMLLayer( os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'SecurityPolicyLayer', allow_teardown=True)
import os import unittest import bookshelf from zope.testing import doctest from zope.app.testing.functional import (FunctionalTestSetup, ZCMLLayer, HTTPCaller, sync, getRootFolder) ftesting_zcml = os.path.join(os.path.dirname(bookshelf.__file__), 'ftesting.zcml') BookShelfFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'BookShelfFunctionalLayer') def setUp(test): FunctionalTestSetup().setUp() def tearDown(test): FunctionalTestSetup().tearDown() def test_suite(): suite = unittest.TestSuite() test_modules = ['catalog', 'xmlrpc'] for module in test_modules: module_name = 'bookshelf.ftests.%s' % module test = doctest.DocTestSuite( module_name, setUp=setUp, tearDown=tearDown,