def setUp(self):
        self.app = self.layer['app']
        self.request = self.layer['request']
        self.portal = self.layer['portal']
        self.portal_url = self.portal.absolute_url()

        # Register custom UUID generator to produce stable UUIDs during tests
        pushGlobalRegistry(getSite())
        register_static_uuid_utility(prefix='SomeUUID')

        self.time_freezer = freeze_time("2016-10-21 19:00:00")
        self.frozen_time = self.time_freezer.start()

        self.api_session = RelativeSession(self.portal_url)
        self.api_session.headers.update({'Accept': 'application/json'})
        self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD)

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.document = self.create_document()

        transaction.commit()
        self.browser = Browser(self.app)
        self.browser.handleErrors = False
        self.browser.addHeader(
            'Authorization',
            'Basic %s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD,)
        )
    def setUp(self):
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]

        pushGlobalRegistry(getSite())
        register_static_uuid_utility(prefix="c6dcbd55ab2746e199cd4ed458")
        self.time_freezer = freeze_time("2019-06-22 12:47:03")
        self.time_freezer.start()

        self.catalog = getToolByName(self.portal, "portal_catalog")

        self.doc1 = createContentInContainer(
            self.portal,
            u"DXTestDocument",
            id=u"doc1",
            title=u"Lorem Ipsum",
            description=u"Description",
        )
示例#3
0
    def setUp(self):
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]

        pushGlobalRegistry(getSite())
        register_static_uuid_utility(prefix="c6dcbd55ab2746e199cd4ed458")

        self.catalog = getToolByName(self.portal, "portal_catalog")

        self.doc1 = createContentInContainer(
            self.portal,
            u"DXTestDocument",
            id=u"doc1",
            title=u"Lorem Ipsum",
            description=u"Description",
        )

        self.doc1.creation_date = DateTime("2016-01-21T01:14:48+00:00")
        self.doc1.modification_date = DateTime("2017-01-21T01:14:48+00:00")
        self.doc1.reindexObject(["modified"])