예제 #1
0
    def tearDown(self):
        from zope.component.testing import tearDown

        from AccessControl.security import clearSecurityInfo
        clearSecurityInfo(Dummy1)
        clearSecurityInfo(Dummy2)
        tearDown()
예제 #2
0
 def tearDown(self):
     try:
         from zope.component.testing import tearDown
     except ImportError:
         pass
     else:
         tearDown()
예제 #3
0
 def tearDown(cls):
     testing.tearDown()
     app = ZopeTestCase.app()
     schema.metadata.drop_all()
     app.manage_delObjects(SANDBOX_ID)
     transaction.commit()
     ZopeTestCase.close(app)
예제 #4
0
 def tearDown(self):
     try:
         from zope.component.testing import tearDown
     except ImportError:
         pass
     else:
         tearDown()
예제 #5
0
 def tearDown(cls):
     testing.tearDown()
     app = ZopeTestCase.app()
     schema.metadata.drop_all()
     app.manage_delObjects( SANDBOX_ID )
     transaction.commit()
     ZopeTestCase.close(app)
예제 #6
0
def clearZCML(test=None):
    from zope.configuration.xmlconfig import XMLConfig
    import zope.component
    from zope.component.testing import setUp
    from zope.component.testing import tearDown
    tearDown()
    setUp()
    XMLConfig('meta.zcml', zope.component)()
예제 #7
0
def clearZCML(test=None):
    from zope.configuration.xmlconfig import XMLConfig
    import zope.component
    from zope.component.testing import setUp
    from zope.component.testing import tearDown
    tearDown()
    setUp()
    XMLConfig('meta.zcml', zope.component)()
예제 #8
0
 def tearDown(self):
     from zope.security.tests import module
     module.test_class = None
     try:
         from zope.component.testing import tearDown
     except ImportError:
         pass
     else:
         tearDown()
예제 #9
0
 def tearDown(cls):
     from pas.plugins.sqlalchemy.model import Base
     Session()
     Base.metadata.drop_all()
     testing.tearDown()
     app = ZopeTestCase.app()
     app.manage_delObjects(SANDBOX_ID)
     transaction.commit()
     ZopeTestCase.close(app)
    def tearDown(self):
        from zope.security.tests.exampleclass import ExampleClass
        try:
            del ExampleClass.__implements__
        except AttributeError:
            pass

        from zope.component.testing import tearDown
        tearDown()
예제 #11
0
 def tearDown(self):
     from zope.security.tests import module
     module.test_class = None
     try:
         from zope.component.testing import tearDown
     except ImportError:
         pass
     else:
         tearDown()
예제 #12
0
    def tearDown(self):
        from zope.security.tests.exampleclass import ExampleClass
        try:
            del ExampleClass.__implements__
        except AttributeError:
            pass

        from zope.component.testing import tearDown
        tearDown()
예제 #13
0
 def tearDown(cls):
     from pas.plugins.sqlalchemy.model import Base
     Session()
     Base.metadata.drop_all()
     testing.tearDown()
     app = ZopeTestCase.app()
     app.manage_delObjects(SANDBOX_ID)
     transaction.commit()
     ZopeTestCase.close(app)
    def tearDown(self):

        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldPolicy)
        del self.oldPolicy
        del self.policy
        del self.folder2
        del self.folder1

        self._cleanApp()
        componenttesting.tearDown()
        CopySupportTestBase.tearDown(self)
예제 #15
0
    def tearDown(self):

        noSecurityManager()
        SecurityManager.setSecurityPolicy(self.oldPolicy)
        del self.oldPolicy
        del self.policy
        del self.folder2
        del self.folder1

        self._cleanApp()
        componenttesting.tearDown()
        CopySupportTestBase.tearDown(self)
예제 #16
0
    def testRequestLocale(self):
        eq = self.assertEqual
        unless = self.failUnless

        from zope.component import provideAdapter
        from zope.publisher.browser import BrowserLanguages
        from zope.publisher.interfaces.http import IHTTPRequest
        from zope.i18n.interfaces import IUserPreferredLanguages
        provideAdapter(BrowserLanguages, [IHTTPRequest],
                       IUserPreferredLanguages)

        for httplang in ('it', 'it-ch', 'it-CH', 'IT', 'IT-CH', 'IT-ch'):
            req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': httplang})
            locale = req.locale
            unless(ILocale.providedBy(locale))
            parts = httplang.split('-')
            lang = parts.pop(0).lower()
            territory = variant = None
            if parts:
                territory = parts.pop(0).upper()
            if parts:
                variant = parts.pop(0).upper()
            eq(locale.id.language, lang)
            eq(locale.id.territory, territory)
            eq(locale.id.variant, variant)
        # Now test for non-existant locale fallback
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, None)
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        # If the first language is not available we should try others
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx,en;q=0.5'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, 'en')
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        # Regression test: there was a bug where territory and variant were
        # not reset
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx-YY,en;q=0.5'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, 'en')
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        from zope.component.testing import tearDown
        tearDown()
예제 #17
0
 def tearDown(self):
     from zope.component.testing import tearDown
     import OFS.metaconfigure
     # restore registrations
     OFS.metaconfigure._meta_type_regs[:] = self._old_mt_regs
     OFS.metaconfigure._register_monkies[:] = self._old_monkies
     if self._old_metatypes is not _marker:
         import Products
         Products.meta_types = self._old_metatypes
     else:
         try:
             del Products.meta_types
         except AttributeError:
             pass
     tearDown()
예제 #18
0
 def tearDown(self):
     from zope.component.testing import tearDown
     import OFS.metaconfigure
     # restore registrations
     OFS.metaconfigure._meta_type_regs[:] = self._old_mt_regs
     OFS.metaconfigure._register_monkies[:] = self._old_monkies
     if self._old_metatypes is not _marker:
         import Products
         Products.meta_types = self._old_metatypes
     else:
         try:
             del Products.meta_types
         except AttributeError:
             pass
     tearDown()
예제 #19
0
파일: test_utils.py 프로젝트: goschtl/zope
    def test_scrubHTML_with_adapter(self):
        from zope.component.testing import setUp
        from zope.component.testing import tearDown
        from zope.component import getSiteManager
        from zope.interface import implements

        from Products.CMFDefault.interfaces import IHTMLScrubber
        from Products.CMFDefault.utils import scrubHTML

        class _Scrubber:
            implements(IHTMLScrubber)
            def scrub(self, html):
                return html.upper()


        setUp()

        sm = getSiteManager()
        try:
            sm.registerUtility(_Scrubber(), IHTMLScrubber)
            self.assertEqual( scrubHTML('<a href="foo.html">bar</a>'),
                            '<A HREF="FOO.HTML">BAR</A>' )
            self.assertEqual( scrubHTML('<b>bar</b>'),
                            '<B>BAR</B>' )
            self.assertEqual( scrubHTML('<base href="" /><base>'),
                            '<BASE HREF="" /><BASE>' )
            self.assertEqual( scrubHTML('<blockquote>bar</blockquote>'),
                            '<BLOCKQUOTE>BAR</BLOCKQUOTE>' )
            self.assertEqual( scrubHTML('<body bgcolor="#ffffff">bar</body>'),
                            '<BODY BGCOLOR="#FFFFFF">BAR</BODY>' )
            self.assertEqual( scrubHTML('<br /><br>'),
                            '<BR /><BR>' )
            self.assertEqual( scrubHTML('<hr /><hr>'),
                            '<HR /><HR>' )
            self.assertEqual( scrubHTML('<img src="foo.png" /><img>'),
                            '<IMG SRC="FOO.PNG" /><IMG>' )
            self.assertEqual( scrubHTML(
                                '<meta name="title" content="" /><meta>'),
                            '<META NAME="TITLE" CONTENT="" /><META>' )

        finally:
            tearDown()
예제 #20
0
파일: basetestcase.py 프로젝트: dtgit/dtedu
    def tearDown(cls):
        testing.tearDown()
        app = ZopeTestCase.app()

        # Remove the tables tests
        cls.execute('DROP TABLE %s' % TESTING_USERS_TABLE)
        cls.execute('DROP TABLE %s' % TESTING_ROLES_TABLE)

        # Remove our sandbox
        app.manage_delObjects(SANDBOX_ID)

        # Remove the testing sqlite database, if existing
        dbFile = 'sqlpasplugin-testing.db'
        dbDir = os.path.join(os.getenv('INSTANCE_HOME'), 'var', 'sqlite')
        dbPath = os.path.join(dbDir, dbFile)
        if os.path.exists(dbDir):
            os.remove(dbPath)

        transaction.commit()
        ZopeTestCase.close(app)
예제 #21
0
    def test_scrubHTML_with_adapter(self):
        from zope.component.testing import setUp
        from zope.component.testing import tearDown
        from zope.component import getSiteManager
        from zope.interface import implements

        from Products.CMFDefault.interfaces import IHTMLScrubber
        from Products.CMFDefault.utils import scrubHTML

        class _Scrubber:
            implements(IHTMLScrubber)

            def scrub(self, html):
                return html.upper()

        setUp()

        sm = getSiteManager()
        try:
            sm.registerUtility(_Scrubber(), IHTMLScrubber)
            self.assertEqual(scrubHTML('<a href="foo.html">bar</a>'),
                             '<A HREF="FOO.HTML">BAR</A>')
            self.assertEqual(scrubHTML('<b>bar</b>'), '<B>BAR</B>')
            self.assertEqual(scrubHTML('<base href="" /><base>'),
                             '<BASE HREF="" /><BASE>')
            self.assertEqual(scrubHTML('<blockquote>bar</blockquote>'),
                             '<BLOCKQUOTE>BAR</BLOCKQUOTE>')
            self.assertEqual(scrubHTML('<body bgcolor="#ffffff">bar</body>'),
                             '<BODY BGCOLOR="#FFFFFF">BAR</BODY>')
            self.assertEqual(scrubHTML('<br /><br>'), '<BR /><BR>')
            self.assertEqual(scrubHTML('<hr /><hr>'), '<HR /><HR>')
            self.assertEqual(scrubHTML('<img src="foo.png" /><img>'),
                             '<IMG SRC="FOO.PNG" /><IMG>')
            self.assertEqual(
                scrubHTML('<meta name="title" content="" /><meta>'),
                '<META NAME="TITLE" CONTENT="" /><META>')

        finally:
            tearDown()
 def tearDown(self):
     testing.tearDown()
예제 #23
0
파일: tests.py 프로젝트: pigaov10/plone4.3
def configurationTearDown(test):
    tearDown()
예제 #24
0
 def tearDown(self):
     testing.tearDown(self)
예제 #25
0
 def tearDown(self):
     placelesssetup.tearDown(self)
예제 #26
0
def tearDown():
    testing.tearDown()
예제 #27
0
def configurationTearDown(test):
    tearDown()
예제 #28
0
 def tearDown(self):
     from zope.component.testing import tearDown
     tearDown()
예제 #29
0
 def tearDown(cls):
     tearDown()
예제 #30
0
파일: tests.py 프로젝트: Shoobx/zope.wfmc
def tearDown(test):
    testing.tearDown(test)
    if zope.event.subscribers:
        zope.event.subscribers.pop()
예제 #31
0
def tearDown(test):
    testing.tearDown(test)
예제 #32
0
def tearDown(test):
    module.tearDown(test)
    testing.tearDown(test)
def reset():
    tearDown()
    setUpAuth()
예제 #34
0
def tearDown(test):
    testing.tearDown(test)
    setup.tearDownTestAsModule(test)
예제 #35
0
 def tearDown(self):
     from zope.component.testing import tearDown
     tearDown()
예제 #36
0
파일: tests.py 프로젝트: Zojax/zojax.mail
def tearDown(test):
    testing.tearDown(test)
    SMTPMailer.send = test.oldseld
 def tearDown(self):
     from zope.component.testing import tearDown
     from zope2 import sessioncookie
     sessioncookie.ZopeCookieSession = None
     tearDown()
예제 #38
0
def tearDown():
    testing.tearDown()
예제 #39
0
 def tearDown(self):
     # unregister adapters registered in tests
     from zope.component.testing import tearDown
     tearDown()
예제 #40
0
 def tearDown(self):
     tearDown()
def reset():
    tearDown()
    setUpAuth()
예제 #42
0
파일: tests.py 프로젝트: grodniewicz/oship
def placefulTearDown():
    resetHooks()
    setSite()
    testing.tearDown()
예제 #43
0
 def tearDown(self):
     super(AttributionTests, self).tearDown()
     tearDown(self)
     placefulTearDown()
예제 #44
0
파일: tests.py 프로젝트: jean/zope.intid
 def tearDown(self):
     resetHooks()
     setSite()
     testing.tearDown()
예제 #45
0
def tearDown(test):
    placelesssetup.tearDown()
예제 #46
0
def tearDown(test):
    placelesssetup.tearDown()
    transaction.abort()
    schema.metadata.drop_all(checkfirst=True)
    orm.clear_mappers()
예제 #47
0
def tearDownConnection(test):
    test.globs['conn'].close()
    tearDown(test)
예제 #48
0
 def tearDown(self):
     # unregister adapters registered in tests
     from zope.component.testing import tearDown
     tearDown()
예제 #49
0
def tearDown(test):
    testing.tearDown(test)
    if zope.event.subscribers:
        zope.event.subscribers.pop()
예제 #50
0
 def tearDown(self):
     resetHooks()
     setSite()
     testing.tearDown()
예제 #51
0
 def tearDown(self):
     super(SearchTests, self).tearDown()
     tearDown(self)
     placefulTearDown()
def vocabTearDown(self):
    tearDown()
    hooks.resetHooks()
    hooks.setSite()
예제 #53
0
 def tearDown(self):
     from zope.security.tests import module
     module.test_class = None
     from zope.component.testing import tearDown
     tearDown()
예제 #54
0
 def tearDown(self):
     from zope.component.testing import tearDown
     from zope2 import sessioncookie
     sessioncookie.ZopeCookieSession = None
     tearDown()
예제 #55
0
 def tearDown(self):
     del perms[:]
     from zope.component.testing import tearDown
     tearDown()
예제 #56
0
 def tearDown(self):
     clearSite()
     tearDown()
예제 #57
0
 def tearDown(self):
     tearDown(self)
예제 #58
0
    def testRequestLocale(self):
        eq = self.assertEqual
        unless = self.failUnless

        from zope.component import provideAdapter
        from zope.publisher.browser import BrowserLanguages
        from zope.publisher.interfaces.http import IHTTPRequest
        from zope.i18n.interfaces import IUserPreferredLanguages
        provideAdapter(BrowserLanguages, [IHTTPRequest],
                       IUserPreferredLanguages)

        for httplang in ('it', 'it-ch', 'it-CH', 'IT', 'IT-CH', 'IT-ch'):
            req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': httplang})
            locale = req.locale
            unless(ILocale.providedBy(locale))
            parts = httplang.split('-')
            lang = parts.pop(0).lower()
            territory = variant = None
            if parts:
                territory = parts.pop(0).upper()
            if parts:
                variant = parts.pop(0).upper()
            eq(locale.id.language, lang)
            eq(locale.id.territory, territory)
            eq(locale.id.variant, variant)
        # Now test for non-existant locale fallback
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, None)
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        # If the first language is not available we should try others
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx,en;q=0.5'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, 'en')
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        # Regression test: there was a bug where territory and variant were
        # not reset
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx-YY,en;q=0.5'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, 'en')
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        # Now test for improper quality value, should ignore the header
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'en;q=xx'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, None)
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        # Now test for very improper quality value, should ignore the header
        req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'asdf;qwer'})
        locale = req.locale
        unless(ILocale.providedBy(locale))
        eq(locale.id.language, None)
        eq(locale.id.territory, None)
        eq(locale.id.variant, None)

        from zope.component.testing import tearDown
        tearDown()