예제 #1
0
    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()
예제 #2
0
파일: tests.py 프로젝트: bendavis78/zope
def getRootFolder():
    return functional.FunctionalTestSetup().getRootFolder()
예제 #3
0
 def tearDown(test):
     if kwtearDown is not None:
         kwtearDown(test)
     functional.FunctionalTestSetup().tearDown()
예제 #4
0
 def setUp(test):
     functional.FunctionalTestSetup().setUp()
     if kwsetUp is not None:
         kwsetUp(test)
예제 #5
0
def tearDown(test):
    functional.FunctionalTestSetup().tearDown()
예제 #6
0
def setUp(test):
    functional.FunctionalTestSetup().setUp()
예제 #7
0
 def tearDown(test):
     setSite(None)
     functional.FunctionalTestSetup().tearDown()