本文整理汇总了Python中pyramid.testing.cleanUp函数的典型用法代码示例。如果您正苦于以下问题:Python cleanUp函数的具体用法?Python cleanUp怎么用?Python cleanUp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cleanUp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
import datetime
from zope.interface import directlyProvides
from karl.content.interfaces import IBlogEntry
cleanUp()
karltesting.registerSettings()
# Create dummy site skel
community = karltesting.DummyCommunity()
site = community.__parent__.__parent__
profiles = testing.DummyModel()
site["profiles"] = profiles
self.profile = profiles["member"] = karltesting.DummyProfile()
profiles["creator"] = karltesting.DummyProfile()
community["blog"] = testing.DummyModel()
blogentry = testing.DummyModel(text="This is a test")
blogentry.created = datetime.datetime(2010, 5, 12, 2, 42)
blogentry.creator = 'member'
community["blog"]["blogentry"] = blogentry
blogentry["attachments"] = testing.DummyModel()
blogentry.title = "Blog Entry"
blogentry.docid = 0
directlyProvides(blogentry, IBlogEntry)
self.blogentry = blogentry
blogentry["comments"] = testing.DummyModel()
self.comment = self._add_comment(blogentry)
开发者ID:claytron,项目名称:karl,代码行数:31,代码来源:test_adapters.py
示例2: setUp
def setUp(self):
testing.cleanUp()
batch = [testing.DummyModel(title="foo"), testing.DummyModel(title="bar")]
class DummyGetImagesBatch(object):
def __call__(self, context, request, **search_params):
self.called = (context, request, search_params)
return dict(
entries=batch,
batch_start=search_params["batch_start"],
batch_size=search_params["batch_size"],
total=5,
)
self.dummy_get_images_batch = DummyGetImagesBatch()
def dummy_get_images_info(image, request):
return image.title
self.dummy_get_images_info = dummy_get_images_info
from karl.views.imagedrawer import batch_images
def wrapped_batch_images(*arg, **kw):
kw["get_image_info"] = self.dummy_get_images_info
kw["get_images_batch"] = self.dummy_get_images_batch
return batch_images(*arg, **kw)
self.dummy_batch_images = wrapped_batch_images
开发者ID:araymund,项目名称:karl,代码行数:30,代码来源:test_imagedrawer.py
示例3: setUp
def setUp(self):
cleanUp()
context = testing.DummyModel(sessions=DummySessions())
self.context = context
request = testing.DummyRequest()
request.environ['repoze.browserid'] = '1'
self.request = request
开发者ID:hj91,项目名称:karl,代码行数:7,代码来源:test_intranets.py
示例4: setUp
def setUp(self):
cleanUp()
# Set up a dummy community files folder
from karl.content.interfaces import ICommunityRootFolder
from karl.testing import DummyCommunity
from karl.testing import DummyProfile
from zope.interface import directlyProvides
community = DummyCommunity()
files = community["files"] = testing.DummyModel()
directlyProvides(files, ICommunityRootFolder)
site = community.__parent__.__parent__
profiles = site["profiles"] = testing.DummyModel()
chris = profiles["chris"] = DummyProfile()
chris.title = "Chris Rossi"
self.context = files
# Register dummy catalog
from zope.interface import Interface
from karl.models.interfaces import ICatalogSearch
karl.testing.registerAdapter(dummy_catalog_search, Interface,
ICatalogSearch)
# Register atom entry adapter
from karl.views.interfaces import IAtomEntry
from karl.content.views.atom import CommunityFileAtomEntry
karl.testing.registerAdapter(
CommunityFileAtomEntry, (Interface, Interface),
IAtomEntry)
karl.testing.registerDummyRenderer('karl.views:templates/atomfeed.pt')
开发者ID:Falmarri,项目名称:karl,代码行数:33,代码来源:test_atom.py
示例5: collective_generic_webbuilder_tearDown
def collective_generic_webbuilder_tearDown(self):
""" cleanUp() is required to clear out the application registry
between tests
"""
for s in _LAUNCHED_SERVERS:
s.tearDown()
testing.cleanUp()
开发者ID:numahell,项目名称:collective.generic.webbuilder,代码行数:7,代码来源:user_testcase.py
示例6: setUp
def setUp(self):
testing.cleanUp()
from karl.models import site
self._save_WeightedText = site.WeightedText
site.WeightedText = None
开发者ID:Falmarri,项目名称:karl,代码行数:7,代码来源:test_site.py
示例7: setUp
def setUp(self):
testing.cleanUp()
self.root = root = karltesting.DummyModel()
root['profiles'] = profiles = karltesting.DummyModel()
root.users = karltesting.DummyUsers()
root['a'] = a = karltesting.DummyModel(creator='chris')
root['b'] = b = karltesting.DummyModel(modified_by='chris')
class DummySearchAdapter(object):
def __init__(self, context):
pass
def __call__(self, **kw):
resolver = lambda x: root.get(x)
if kw.get('creator') == 'chris':
return 1, ['a'], resolver
if kw.get('modified_by') == 'chris':
return 1, ['b'], resolver
return 0, [], resolver
from zope.interface import Interface
from karl.models.interfaces import ICatalogSearch
karltesting.registerAdapter(DummySearchAdapter, (Interface, Interface),
ICatalogSearch)
karltesting.registerAdapter(DummySearchAdapter, (Interface,),
ICatalogSearch)
root.catalog = catalog = karltesting.DummyModel()
catalog['creator'] = DummyCatalogIndex()
catalog['modified_by'] = DummyCatalogIndex()
开发者ID:Falmarri,项目名称:karl,代码行数:32,代码来源:test_rename_user.py
示例8: layer_tearDown
def layer_tearDown(self):
""" cleanUp() is required to clear out the application registry
between tests
"""
for s in utils._LAUNCHED_SERVERS:
s.tearDown()
testing.cleanUp()
开发者ID:collective,项目名称:collective.generic.webbuilder,代码行数:7,代码来源:test_doctests.py
示例9: setUp
def setUp(self):
cleanUp()
import os
try:
# avoid spew from chameleon logger?
os.unlink(self._getTemplatePath('minimal.txt.py'))
except:
pass
开发者ID:RyoAbe,项目名称:pyramid,代码行数:8,代码来源:test_chameleon_text.py
示例10: setUp
def setUp(self):
testing.cleanUp()
self.context = context = testing.DummyModel()
context.catalog = DummyCatalog()
context['path'] = testing.DummyModel()
context['path']['to'] = testing.DummyModel()
context['path']['to']['item'] = testing.DummyModel()
开发者ID:araymund,项目名称:karl,代码行数:8,代码来源:test_tags.py
示例11: setUp
def setUp(self):
cleanUp()
self._register()
context = DummyNewsItem(sessions=DummySessions())
context.title = 'Foo'
self.context = context
request = testing.DummyRequest()
request.environ['repoze.browserid'] = '1'
self.request = request
开发者ID:mindreframer,项目名称:python-pyramid-stuff,代码行数:9,代码来源:test_newsitem.py
示例12: setUp
def setUp(self):
testing.cleanUp()
request = testing.DummyRequest()
request.environ['repoze.browserid'] = '1'
self.request = request
sessions = DummySessions()
context = testing.DummyModel(sessions=sessions)
self.context = context
registerLayoutProvider()
开发者ID:araymund,项目名称:karl,代码行数:9,代码来源:test_page.py
示例13: layer_setUp
def layer_setUp(self):
""" cleanUp() is required to clear out the application registry
between tests (done in setUp for good measure too)
"""
testing.cleanUp()
config = testing.setUp()
config.include('pyramid_zcml')
for zcml in CGWG_ZCMLS:
config.load_zcml('collective.generic.webbuilder:%s' % zcml)
开发者ID:collective,项目名称:collective.generic.webbuilder,代码行数:9,代码来源:test_doctests.py
示例14: setUp
def setUp(self):
testing.cleanUp()
karl.testing.registerSettings(mailin_trace_file='foo/bar')
from karl.content.views import blog
self._save_os = blog.os
blog.os = self
self._exists = False
开发者ID:hj91,项目名称:karl,代码行数:10,代码来源:test_blog.py
示例15: setUp
def setUp(self):
testing.cleanUp()
from karl.content.models import blog
self._save_os = blog.os
blog.os = self
self._utime_called = None
self._exists = set()
karl.testing.registerSettings(mailin_trace_file='trace_file')
开发者ID:Falmarri,项目名称:karl,代码行数:10,代码来源:test_blog.py
示例16: setUp
def setUp(self):
cleanUp()
import os
try:
# avoid spew from chameleon logger?
os.unlink(self._getTemplatePath('minimal.txt.py'))
except:
pass
from zope.deprecation import __show__
__show__.off()
开发者ID:blaflamme,项目名称:pyramid,代码行数:10,代码来源:test_chameleon_text.py
示例17: setUp
def setUp(self):
testing.cleanUp()
from karl.models.interfaces import ISite
site = testing.DummyModel(sessions=DummySessions())
directlyProvides(site, ISite)
self.context = site
request = testing.DummyRequest()
request.environ['repoze.browserid'] = '1'
self.request = request
karl.testing.registerDummyRenderer(
'karl.views:forms/templates/snippets.pt')
开发者ID:zagy,项目名称:karl,代码行数:11,代码来源:test_resetpassword.py
示例18: setUp
def setUp(self):
cleanUp()
self.parent = DummyModel(title="dummyparent")
self.context = DummyModel(title="dummytitle", text="dummytext")
self.context["attachments"] = DummyModel()
self.parent["child"] = self.context
self.parent.catalog = DummyCatalog()
self.parent["profiles"] = DummyModel()
users = self.parent.users = DummyUsers()
users.add("userid", "userid", "password", [])
开发者ID:araymund,项目名称:karl,代码行数:11,代码来源:test_custom_folderviews.py
示例19: setUp
def setUp(self):
testing.cleanUp()
import os
from pyramid.interfaces import ISettings
from karl.views.tests import test_admin
# get the dir for existing test file for admin views
test_dir = os.path.abspath(os.path.dirname(test_admin.__file__))
settings = karltesting.DummySettings(
statistics_folder=test_dir,
)
karltesting.registerUtility(settings, ISettings)
开发者ID:hj91,项目名称:karl,代码行数:11,代码来源:test_panels.py
示例20: setUp
def setUp(self):
testing.cleanUp()
from karl.testing import registerSettings
registerSettings()
site = makeRoot()
self.context = site
request = testing.DummyRequest()
request.environ['repoze.browserid'] = '1'
self.request = request
karl.testing.registerDummyRenderer(
'karl.views:forms/templates/snippets.pt')
开发者ID:lslaz1,项目名称:karl,代码行数:11,代码来源:test_resetpassword.py
注:本文中的pyramid.testing.cleanUp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论