Back to index

plone3  3.1.7
test_kssview.py
Go to the documentation of this file.
00001 # -*- coding: latin-1 -*-
00002 # Copyright (c) 2005-2007
00003 # Authors: KSS Project Contributors (see docs/CREDITS.txt)
00004 #
00005 # This program is free software; you can redistribute it and/or modify
00006 # it under the terms of the GNU General Public License version 2 as published
00007 # by the Free Software Foundation.
00008 #
00009 # This program is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 # GNU General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU General Public License
00015 # along with this program; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017 # 02111-1307, USA.
00018 
00019 import unittest
00020 
00021 from kss.core.interfaces import IKSSView, IKSSCommands
00022 from kss.core.plugins.core.interfaces import IKSSCoreCommands
00023 from kss.core.plugins.core.commands import KSSCoreCommands
00024 from kss.core.pluginregistry.interfaces import IAction, ICommandSet
00025 from kss.core.pluginregistry.action import Action
00026 from kss.core.pluginregistry.plugin import registerPlugin
00027 from kss.core.pluginregistry.commandset import CommandSet
00028 from kss.core.tests.commandinspector import CommandInspectorView
00029 
00030 import zope.component.event
00031 from zope.testing import doctest, cleanup
00032 from zope.publisher.interfaces.browser import IBrowserRequest
00033 from zope.app.component.hooks import setHooks
00034 
00035 def setUpAjaxView(test=None):
00036     setHooks()
00037     zope.component.provideAdapter(CommandInspectorView,
00038                                   adapts=(IKSSCommands, IBrowserRequest))
00039     registerPlugin(Action, IAction, 'replaceInnerHTML', None,
00040                    'selector', 'html', [], None)
00041     zope.component.provideAdapter(KSSCoreCommands,
00042                                   adapts=(IKSSView,),
00043                                   provides=IKSSCoreCommands)
00044     registerPlugin(CommandSet, ICommandSet, 'core', IKSSCoreCommands)
00045 
00046 def tearDownAjaxView(test=None):
00047     cleanup.cleanUp()
00048 
00049 def test_suite():
00050     return unittest.TestSuite([
00051         doctest.DocTestSuite('kss.core.kssview'),
00052         doctest.DocFileSuite('kssview.txt',
00053                              package='kss.core',
00054                              setUp=setUpAjaxView,
00055                              tearDown=tearDownAjaxView),
00056         ])