def setUp(test): functional.FunctionalTestSetup().setUp() root = functional.getRootFolder() setSite(root) # IIntIds root['ids'] = IntIds() root.getSiteManager().registerUtility(root['ids'], IIntIds) # HomeFolderManager manager = PersonalSpaceManager(title=u'People') event.notify(ObjectCreatedEvent(manager)) root['people'] = manager root.getSiteManager().registerUtility(root['people'], IPersonalSpaceManager) principal = root.getSiteManager().getUtility( IAuthentication).getPrincipal('zope.user') manager.assignPersonalSpace(principal) # profiles category configlet = component.getUtility(IProfilesCategory) configlet.fieldCategories = [u'Category1', u'Category2']
def setUp(test): functional.FunctionalTestSetup().setUp() newInteraction() def fake_utcnow(self): return datetime.datetime(2015, 7, 30, 8, 0, 0) curse(datetime.datetime, 'utcnow', classmethod(fake_utcnow)) root = functional.getRootFolder() setSite(root) sm = root.getSiteManager() # IIntIds root['intids'] = IntIds() sm.registerUtility(root['intids'], IIntIds) root['intids'].register(root) # catalog root['catalog'] = Catalog() sm.registerUtility(root['catalog'], ICatalog) # PluggableAuthentication pau = PluggableAuthentication(u'') event.notify(ObjectCreatedEvent(pau)) sm[u'auth'] = pau sm.registerUtility(pau, IAuthentication) # Credentials Plugin defaultCreds.install() defaultCreds.activate() # people people = PersonalSpaceManager(title=u'People') event.notify(ObjectCreatedEvent(people)) root['people'] = people sm.registerUtility(root['people'], IPersonalSpaceManager) user = sm.getUtility(IAuthentication).getPrincipal('zope.mgr') people.assignPersonalSpace(user) user = sm.getUtility(IAuthentication).getPrincipal('zope.user') people.assignPersonalSpace(user) # default content content = Content(u'Content1', u'Some Content1') event.notify(ObjectCreatedEvent(content)) IOwnership(content).ownerId = 'zope.user' root['content1'] = content content = Content(u'Content2', u'Some Content2') event.notify(ObjectCreatedEvent(content)) IOwnership(content).ownerId = 'zope.user' root['content2'] = content endInteraction()
def setUp(test): functional.FunctionalTestSetup().setUp() newInteraction() root = functional.getRootFolder() setSite(root) sm = root.getSiteManager() setattr(root, 'title', 'Site Title') # IIntIds root['ids'] = IntIds() sm.registerUtility(root['ids'], IIntIds) root['ids'].register(root) # catalog root['catalog'] = Catalog() sm.registerUtility(root['catalog'], ICatalog) # space space = ContentSpace(title=u'Space') event.notify(ObjectCreatedEvent(space)) root['space'] = space #space site = TestSite() site.setSiteManager(LocalSiteManager(root)) event.notify(ObjectCreatedEvent(site)) root['site'] = site # people people = PersonalSpaceManager(title=u'People') event.notify(ObjectCreatedEvent(people)) root['people'] = people sm.registerUtility(root['people'], IPersonalSpaceManager) user = sm.getUtility(IAuthentication).getPrincipal('zope.mgr') people.assignPersonalSpace(user) user = sm.getUtility(IAuthentication).getPrincipal('zope.user') people.assignPersonalSpace(user) endInteraction()
def setUp(test): functional.FunctionalTestSetup().setUp() newInteraction() def fake_utcnow(self): return datetime.datetime(2015, 7, 30, 8, 0, 0) curse(datetime.datetime, 'utcnow', classmethod(fake_utcnow)) root = functional.getRootFolder() setSite(root) sm = root.getSiteManager() # IIntIds root['intids'] = IntIds() sm.registerUtility(root['intids'], IIntIds) root['intids'].register(root) # catalog root['catalog'] = Catalog() sm.registerUtility(root['catalog'], ICatalog) # PluggableAuthentication pau = PluggableAuthentication(u'') event.notify(ObjectCreatedEvent(pau)) sm[u'auth'] = pau sm.registerUtility(pau, IAuthentication) # Credentials Plugin defaultCreds.install() defaultCreds.activate() # people people = PersonalSpaceManager(title=u'People') event.notify(ObjectCreatedEvent(people)) root['people'] = people sm.registerUtility(root['people'], IPersonalSpaceManager) user = sm.getUtility(IAuthentication).getPrincipal('zope.mgr') people.assignPersonalSpace(user) user = sm.getUtility(IAuthentication).getPrincipal('zope.user') people.assignPersonalSpace(user) # default content content = Content(u'Content1', u'Some Content1') event.notify(ObjectCreatedEvent(content)) IOwnership(content).ownerId = 'zope.user' root['content1'] = content content = Content(u'Content2', u'Some Content2') event.notify(ObjectCreatedEvent(content)) IOwnership(content).ownerId = 'zope.user' root['content2'] = content endInteraction()