Ejemplo n.º 1
0
    def setUp(self):
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]

        setRoles(self.portal, TEST_USER_ID, ["Manager"])
        login(self.portal, TEST_USER_NAME)
        transaction.commit()
Ejemplo n.º 2
0
 def setUpPloneSite(self, portal):
     # Install into Plone site using portal_setup
     self.applyProfile(portal, '%s:default' % PROJECTNAME)
     login(portal, TEST_USER_NAME)
     setRoles(portal, TEST_USER_ID, ['Manager'])
     portal.invokeFactory('Survey', 's1')
     s1 = getattr(portal, 's1')
     s1.setAllowAnonymous(True)
     # workflow_tool = getToolByName(portal, 'portal_workflow')
     # workflow_tool.doActionFor(s1,'publish')
     s1.setEmailInvite(DEFAULT_SURVEY_INVITE)
     s1.invokeFactory('Sub Survey', 'ss1')
     s1.invokeFactory('Sub Survey', 'ss2')
     s1.invokeFactory('Sub Survey', 'ss3')
     ss1 = getattr(s1, 'ss1')
     ss2 = getattr(s1, 'ss2')
     ss3 = getattr(s1, 'ss3')
     s1.invokeFactory('Survey Select Question', 'ssq1')
     ss1.invokeFactory('Survey Select Question', 'ssq2')
     ss2.invokeFactory('Survey Select Question', 'ssq3')
     ss1.setRequiredQuestion('ssq1')
     ss1.setRequiredAnswer('No')
     ss2.setRequiredQuestion('ssq1')
     ss2.setRequiredAnswer('Yes')
     ss3.setRequiredQuestion('ssq2')
     ss3.setRequiredAnswer('Yes')
 def setUp(self):
     """Custom shared utility setup for tests."""
     self.portal = self.layer['portal']
     login(self.portal, TEST_USER_NAME)
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     self.folder = api.content.create(
         container=self.portal, type='Folder', title='Folder')
Ejemplo n.º 4
0
    def test_breadcrumbs(self):
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        login(portal, TEST_USER_NAME)

        portal.invokeFactory('Document', 'first_level_document')
        portal.invokeFactory('Folder', 'first_level_folder',
                             title='First Level Folder')
        first_level_folder = portal.first_level_folder
        first_level_folder.invokeFactory('Document', 'second_level_document')
        first_level_folder.invokeFactory('Folder', 'second_level_folder')
        second_level_folder = first_level_folder.second_level_folder
        second_level_folder.invokeFactory('Document', 'third_level_document')

        view = portal.restrictedTraverse('@@search')

        def crumbs(item):
            return view.breadcrumbs(IContentListing([item])[0])

        # return None for first_level objects
        title = crumbs(portal.first_level_document)
        self.assertEqual(title, None)

        title = crumbs(first_level_folder)
        self.assertEqual(title, None)

        # return section for objects deeper in the hierarchy
        title = crumbs(first_level_folder.second_level_document)[0]['Title']
        self.assertEqual(title, 'First Level Folder')

        title = crumbs(second_level_folder)[0]['Title']
        self.assertEqual(title, 'First Level Folder')

        title = crumbs(second_level_folder.third_level_document)[0]['Title']
        self.assertEqual(title, 'First Level Folder')
Ejemplo n.º 5
0
    def test_ATPathCriterionMultiNonRecursive(self):
        # Collections support multiple paths since
        # plone.app.querystring 1.2.0.
        login(self.portal, 'admin')
        self.portal.invokeFactory('Folder', 'folder2', title='Folder 2')
        crit = self.add_criterion(
            'path',
            'ATPathCriterion',
            [self.portal.folder.UID(), self.portal.folder2.UID()]
        )
        crit.setRecurse(False)
        applyProfile(self.portal, 'plone.app.contenttypes:default')
        self.run_migration()
        query = self.portal.topic.query
        self.assertEqual(len(query), 2)
        self.assertEqual(query[0],
                         {'i': 'path',
                          'o': 'plone.app.querystring.operation.string.path',
                          'v': self.portal.folder.UID() + '::1'})
        self.assertEqual(query[1],
                         {'i': 'path',
                          'o': 'plone.app.querystring.operation.string.path',
                          'v': self.portal.folder2.UID() + '::1'})

        # Check that the resulting query does not give an error.
        self.portal.topic.results
Ejemplo n.º 6
0
 def setUp(self):
     self.portal = self.layer['portal']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
     self.portal.invokeFactory('Folder', 'test-folder')
     self.folder = self.portal['test-folder']
     self.portal = self.layer['portal']
     self.folder.invokeFactory("EasyNewsletter", "newsletter")
     self.newsletter = self.folder.newsletter
     self.newsletter.senderEmail = "*****@*****.**"
     self.newsletter.senderName = "ACME newsletter"
     self.newsletter.testEmail = "*****@*****.**"
     # Set up a mock mailhost
     self.portal._original_MailHost = self.portal.MailHost
     self.portal.MailHost = mailhost = MockMailHost('MailHost')
     sm = getSiteManager(context=self.portal)
     sm.unregisterUtility(provided=IMailHost)
     sm.registerUtility(mailhost, provided=IMailHost)
     # We need to fake a valid mail setup
     self.portal.email_from_address = "*****@*****.**"
     self.mailhost = self.portal.MailHost
     # image for image testing
     self.folder.invokeFactory("Image", "image")
     self.image = self.folder.image
     img1 = open(os.path.join(TESTS_HOME, 'img1.png'), 'rb').read()
     self.image.edit(image=img1)
    def test_handler(self):
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        login(portal, TEST_USER_NAME)

        portal.invokeFactory('Document', 'referenced')
        vocabulary = ReferenceableVocabulary(portal.referenced)

        ref_schema = ATDocument.schema.copy() + \
            Schema(
                (StringField(
                    name='folderCategory',
                    enforceVocabulary=True,
                    vocabulary=vocabulary,
                    ),
                ))

        class WithReferencedField(ATDocument):
            schema = ref_schema

        registerType(WithReferencedField, 'p.a.referenceintegrity')

        from plone.app.referenceintegrity import vocabularies

        source = WithReferencedField('source')
        source = source.__of__(self.layer['portal'])
        source.initializeArchetype()

        vocabularies.modifiedArchetype(source, None)

        references = source.getReferences(relationship=vocabularyRelationship)
        self.assertEquals([portal.referenced], references)
Ejemplo n.º 8
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        login(self.portal, TEST_USER_NAME)
        transaction.commit()
    def setUp(self):
        self.portal = self.layer['portal']
        self.portal_url = self.portal.portal_url()
        # create EasyNewsletter instance and add some subscribers
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        login(self.portal, TEST_USER_NAME)
        self.portal._original_MailHost = self.portal.MailHost
        self.portal.MailHost = mailhost = MockMailHost('MailHost')
        sm = getSiteManager(context=self.portal)
        sm.unregisterUtility(provided=IMailHost)
        sm.registerUtility(mailhost, provided=IMailHost)
        self.mail_host = getUtility(IMailHost)

        if not IS_PLONE_5:  # BBB
            self.portal.email_from_address = "*****@*****.**"
            self.portal.email_from_name = u"Plone Master"
            self.mail_host.smtp_host = u"example.com"
            self.mail_host.smtp_port = 25
            self.mail_host.smtp_userid = u"*****@*****.**"
            self.mail_host.smtp_pass = u"Password"
        else:
            self.registry = getUtility(IRegistry)
            reg_mail = self.registry.forInterface(
                IMailSchema, prefix='plone')
            reg_mail.email_from_address = '*****@*****.**'
            reg_mail.email_from_name = u'Plone Master'
            reg_mail.smtp_host = u'example.com'
            reg_mail.smtp_port = 25
            reg_mail.smtp_userid = u'*****@*****.**'
            reg_mail.smtp_pass = u'Password'
Ejemplo n.º 10
0
 def setUp(self):
     self.portal = self.layer['portal']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
     self.portal.invokeFactory('Folder', 'test-folder')
     self.folder = self.portal['test-folder']
     self.types = self.portal.portal_types
 def testUserManagerRoleCheckboxIsDisabledForNonManagers(self):
     login(self.portal, 'siteadmin')
     view = self.portal.restrictedTraverse('@@usergroup-userprefs')
     contents = view()
     self.assertTrue('<input type="checkbox" class="noborder" '
                     'name="users.roles:list:records" value="Manager" '
                     'disabled="disabled" />' in contents)
Ejemplo n.º 12
0
    def tearDown(self):
        super(TestListingBlockViews, self).tearDown()
        portal = self.layer['portal']
        login(portal, TEST_USER_NAME)
        portal.manage_delObjects(['contentpage'])

        transaction.commit()
    def test_getFoldersAndImages_returning_images(self):
        portal = self.layer['portal']
        login(portal, 'admin')
        # add a collection, so we can add a query to it
        portal.invokeFactory("Collection",
                             "collection",
                             title="New Collection")

        # add example folder
        portal.invokeFactory("Folder",
                             "folder1",
                             title="Folder1")
        folder = portal['folder1']

        # add example image into this folder
        folder.invokeFactory("Image",
                             "image",
                             title="Image example")

        # add another image into the portal root
        portal.invokeFactory("Image",
                             "image",
                             title="Image example")
        query = [{
            'i': 'Type',
            'o': 'plone.app.querystring.operation.string.is',
            'v': 'Image',
        }]
        collection = portal['collection']
        wrapped = ICollection_behavior(collection)
        wrapped.query = query
        imagecount = wrapped.getFoldersAndImages()['total_number_of_images']
        self.assertEqual(imagecount, 2)
Ejemplo n.º 14
0
def createMembers(portal, userdefs, log_in=True):
    """Create example members in testing environment

    example_userdefs = [
            {'user': '******', 'roles': ('Member', 'Manager'), 'groups': ()},
            {'user': '******', 'roles': ('Member', ), 'groups': ()},
            {'user': '******', 'roles': (), 'groups': ('contributeurs',)},
            {'user': '******', 'roles': (), 'groups': ('animateurs',)},
            ]
    """
    if log_in:
        setRoles(portal, TEST_USER_ID, ["Manager"])
        login(portal, TEST_USER_NAME)

    pas = portal.acl_users
    gtool = portal.portal_groups
    for userinfo in userdefs:
        username = userinfo["user"]
        addMember(pas, username, roles=userinfo["roles"])
        member = portal.portal_membership.getMemberById(username)
        member.setMemberProperties({"email": "*****@*****.**" % username, "fullname": username.title()})
        for groupname in userinfo["groups"]:
            group = gtool.getGroupById(groupname)
            group.addMember(username)

    if log_in:
        setRoles(portal, TEST_USER_ID, ["Member"])
        logout()
    def test_questionDeletion(self):
        """After a question is deleted, can't get it"""
        # Create a temporary question
        login(self.layer['portal'], MANAGER_ID)
        self.layer['portal']['dept1']['tut1']['lec1'].invokeFactory(
            type_name="tw_latexquestion",
            id="qntmp",
            title="Unittest D1 T1 L1 QTmp",
        )
        self.notifyModify(self.layer['portal']['dept1']['tut1']['lec1'])
        transaction.commit()

        # Get qb1, q2, qntmp
        aAlloc = self.getJson('http://nohost/plone/dept1/tut1/lec1/@@quizdb-sync', user=USER_A_ID)
        self.assertEqual(len(aAlloc['questions']), 3)
        qntmp = [
            qn['uri'] for qn
            in aAlloc['questions']
            if self.getJson(qn['uri'])['title'] == 'Unittest D1 T1 L1 QTmp'
        ][0]

        # Delete QTmp
        browser = self.getBrowser('http://nohost/plone/dept1/tut1/lec1/qntmp/delete_confirmation', user=MANAGER_ID)
        browser.getControl('Delete').click()

        # Can't fetch qntmp no more
        self.getJson(qntmp, expectedStatus=404, user=USER_A_ID)

        # Sync again, only get q1 & q2
        aAlloc = self.getJson('http://nohost/plone/dept1/tut1/lec1/@@quizdb-sync', user=USER_A_ID)
        self.assertEqual(len(aAlloc['questions']), 2)

        # Still can't fetch qntmp no more
        self.getJson(qntmp, expectedStatus=404, user=USER_A_ID)
    def test_link_fields_provided(self):
        link_id = 'ixds'
        login(self.portal, self.project_admin.id)
        self.project.invokeFactory('RichLink', link_id, title="IXDS",
                                   url="http://www.ixds.com", rmAuthor="IXDS",
                                   public=False, project_featured=False)
        link = self.project[link_id]

        fields = list(helpers.schema_and_fields_of(link))

        expected_fields = [
            'ixds.library.richlink.IRichLink.url',
            'plone.app.dexterity.behaviors.metadata.IBasic.title',
            'plone.app.dexterity.behaviors.metadata.IBasic.description',
            'ixds.library.behaviors.richmetadata.IRichMetaData.public',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmMediaType',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmAuthor',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmSubtitle',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmPublisher',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmPublicationDate',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmURL',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmLocation',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmFormat',
            'ixds.library.behaviors.richmetadata.IRichMetaData.rmTags',
            'cnrd.vctypes.behaviors.rm_groups.IRmGroupAssignable.rmGroup',
            'cnrd.vctypes.interfaces.IProjectContent.project_featured']

        self.assertEqual(fields, expected_fields)
Ejemplo n.º 17
0
    def setUpPloneSite(self, portal):
        self.registerVocabularies()
        applyProfile(portal, 'plone.app.collection:default')
        applyProfile(portal, 'archetypes.querywidget:test_fixture')
        portal.acl_users.userFolderAddUser('admin',
                                           'secret',
                                           ['Manager'],
                                           [])
        login(portal, 'admin')

        # enable workflow for browser tests
        workflow = portal.portal_workflow
        workflow.setDefaultChain('simple_publication_workflow')

        # add a page, so we can test with it
        portal.invokeFactory("Document",
                             "document",
                             title="Document Test Page")
        # and add a collection so we can test the widget
        portal.invokeFactory("Collection",
                             "collection",
                             title="Test Collection")

        workflow.doActionFor(portal.document, "publish")
        workflow.doActionFor(portal.collection, "publish")
Ejemplo n.º 18
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.catalog = api.portal.get_tool('portal_catalog')
        self.request = self.layer['request']
        self.request.form.update({'name': vocab,
                                  'field': 'subjects'})

        api.user.create(username='******', email='*****@*****.**')
        setRoles(self.portal, 'john_doe', ['Manager', ])
        api.user.create(username='******', email='*****@*****.**')
        setRoles(self.portal, 'mary_jane', ['Manager', ])

        login(self.portal, 'john_doe')

        self.doc1 = api.content.create(
            container=self.portal,
            type='Document',
            id='doc1',
            title='Doc 1'
        )
        few = [u'a_%d_♥' % i for i in xrange(5)]
        few.extend([u'b_%d_☀' % i for i in xrange(5)])
        self.tag(self.doc1, *few)

        self.doc2 = api.content.create(
            container=self.portal,
            type='Document',
            id='doc2',
            title='Doc 2'
        )
Ejemplo n.º 19
0
    def setUp(self):
        self.portal = self.layer['portal']

        login(self.portal, TEST_USER_NAME)
        setRoles(self.portal, TEST_USER_ID, ['Manager'])

        self.portal.invokeFactory(id='f1', type_name='Folder')
 def testManagerPublishesPrivateFolder(self):
     self.workflow.doActionFor(self.dir, 'hide')
     self.assertEqual(self._state(self.dir), 'private')
     login(self.portal, 'manager')
     self.workflow.doActionFor(self.dir, 'publish')
     self.assertEqual(self._state(self.dir), 'published')
     self.assertTrue(self.catalog(id='dir', review_state='published'))
 def testManagerRetractsPublishedFolder(self):
     self.workflow.doActionFor(self.dir, 'publish')
     self.assertEqual(self._state(self.dir), 'published')
     login(self.portal, 'manager')
     self.workflow.doActionFor(self.dir, 'retract')
     self.assertEqual(self._state(self.dir), 'visible')
     self.assertTrue(self.catalog(id='dir', review_state='visible'))
Ejemplo n.º 22
0
    def tearDown(self):
        portal = self.layer['portal']
        login(portal, MANAGER_ID)

        # Remove any temporary Plone objects
        for l in reversed(getattr(self, 'tempObjects', [])):
            del aq_parent(l)[l.id]

        # Drop all DB tables & recreate
        Session().execute("DROP TABLE allocation")
        Session().execute("DROP TABLE lecture")
        Session().execute("DROP TABLE lectureGlobalSetting")
        Session().execute("DROP TABLE lectureStudentSetting")
        Session().execute("DROP TABLE lectureQuestions")
        Session().execute("DROP TABLE question")
        Session().execute("DROP TABLE student")
        Session().execute("DROP TABLE answer")
        Session().execute("DROP TABLE answerSummary")
        Session().execute("DROP TABLE userGeneratedQuestions")
        Session().execute("DROP TABLE userGeneratedAnswer")
        Session().execute("DROP TABLE coinAward")
        ORMBase.metadata.create_all(Session().bind)

        transaction.commit()
        super(FunctionalTestCase, self).tearDown()
Ejemplo n.º 23
0
 def setUp(self):
     portal = self.layer['portal']
     self.tp_catalog = portal.tablepage_catalog
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []},
                           ],
             batchSize=10)
     tp.edit(searchConfig=[{'id': 'foo_field', 'label': '', 'description': '',
                            'additionalConfiguration': ['SearchableText']}])
     self.tp = tp
     self.storage = IDataStorage(tp)
     self._addRows(35)
     # now adding another tablepage: this must be always ignored by searches
     portal.invokeFactory(type_name='TablePage', id='table_page2', title="Another Table Document")
     portal.table_page2.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                                           'type': 'String', 'vocabulary': '', 'options': []},
                                           ],
                                           batchSize=10)
     storage2 = IDataStorage(portal.table_page2)
     storage2.add({'__label__': 'A Label', '__uuid__': 'l2l2l2'})
     storage2.add({'foo_field': 'aa001', '__uuid__': '010'})
     portal.portal_workflow.doActionFor(tp, 'publish')
     self.tp_catalog.clearFindAndRebuild()
     logout()
    def setUp(self):
        super(TestHiddenAnalyses, self).setUp()
        login(self.portal, TEST_USER_NAME)
        servs = self.portal.bika_setup.bika_analysisservices

        # analysis-service-3: Calcium (Ca)
        # analysis-service-6: Cooper (Cu)
        # analysis-service-7: Iron (Fe)
        self.services = [servs['analysisservice-3'],
                         servs['analysisservice-6'],
                         servs['analysisservice-7']]

        # Calcium - Hidden not set
        # Copper  - Hidden set to False
        self.services[1].setHidden(False)
        # Iron    - Hidden set to True
        self.services[2].setHidden(True)

        profs = self.portal.bika_setup.bika_analysisprofiles
        # analysisprofile-1: Trace Metals
        self.analysisprofile = profs['analysisprofile-1']

        artemp = self.portal.bika_setup.bika_artemplates
        # artemplate-2: Bruma Metals
        self.artemplate = artemp['artemplate-2']
Ejemplo n.º 25
0
    def test_levels(self):
        """Tests the 'levels' setting
        """
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        login(portal, TEST_USER_NAME)

        self.createContent()

        # Setup the portlet so that only one size is used.
        r = self.renderer(context=portal,
                          assignment=tagcloudportlet.Assignment(
                              levels=1,
                          ))
        r = r.__of__(portal)
        r.update()
        output = r.render()
        self.failUnless('cloud1' in output)
        self.failIf('cloud2' in output)

        # Setup the portlet so that there can be
        # up to 3 different tag sizes.
        r = self.renderer(context=portal,
                          assignment=tagcloudportlet.Assignment(
                              levels=3,
                          ))
        r = r.__of__(portal)
        r.update()
        output = r.render()

        self.failUnless('cloud1' in output)
        self.failUnless('cloud3' in output)
    def setUp(self):
        self.mail_settings = get_portal_mail_settings()
        self.portal = self.layer['portal']
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        login(self.portal, TEST_USER_NAME)
        self.portal.invokeFactory('Folder', 'test-folder')
        self.folder = self.portal['test-folder']
        self.portal = self.layer['portal']
        self.folder.invokeFactory("EasyNewsletter", "newsletter")
        self.newsletter = self.folder.newsletter
        self.newsletter.senderEmail = "*****@*****.**"
        self.newsletter.senderName = "ACME newsletter"
        self.newsletter.testEmail = "*****@*****.**"

        # Set up a mock mailhost
        self.portal._original_MailHost = self.portal.MailHost
        self.portal.MailHost = mailhost = MockMailHost('MailHost')
        sm = getSiteManager(context=self.portal)
        sm.unregisterUtility(provided=IMailHost)
        sm.registerUtility(mailhost, provided=IMailHost)
        # We need to fake a valid mail setup
        # self.mail_settings.email_from_address = u'*****@*****.**'
        self.mailhost = self.portal.MailHost
        # image for image testing
        self.folder.invokeFactory("Image", "image")
        self.image = self.folder.image
        image = self.folder['image']
        image.title = 'My Image'
        image.description = 'This is my image.'
        image.image = dummy_image(image)
        self.image = image
Ejemplo n.º 27
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        # TYPE 1
        type1_fti = DexterityFTI('type1')
        type1_fti.klass = 'plone.dexterity.content.Container'
        type1_fti.filter_content_types = True
        type1_fti.allowed_content_types = []
        type1_fti.behaviors = (
            'plone.app.dexterity.behaviors.metadata.IBasic',
        )
        self.portal.portal_types._setObject('type1', type1_fti)
        self.type1_fti = type1_fti

        # TYPE 2
        type2_fti = DexterityFTI('type1')
        type2_fti.klass = 'plone.dexterity.content.Item'
        type2_fti.filter_content_types = True
        type2_fti.allowed_content_types = []
        type2_fti.behaviors = (
            'plone.app.dexterity.behaviors.metadata.IBasic',
        )
        self.portal.portal_types._setObject('type2', type2_fti)
        self.type2_fti = type2_fti

        login(self.portal, TEST_USER_NAME)
        setRoles(self.portal, TEST_USER_ID, ['Manager'])

        self.portal.invokeFactory('type1', id='it1', title='Item 1')
        self.portal.invokeFactory('type2', id='it2', title='Item 2')
 def setUp(self):
     super(Test_ShowPrices, self).setUp()
     login(self.portal, TEST_USER_NAME)
     self.client = self.addthing(
         self.portal.clients,
         'Client', title='Happy Hills', ClientID='HH')
     contact = self.addthing(
         self.client,
         'Contact', Firstname='Rita', Lastname='Mohale')
     container = self.addthing(
         self.portal.bika_setup.bika_containers,
         'Container', title='Bottle', capacity="10 ml")
     sampletype = self.addthing(
         self.portal.bika_setup.bika_sampletypes,
         'SampleType', title='Water', Prefix='H2O')
     self.service1 = self.addthing(
         self.portal.bika_setup.bika_analysisservices,
         'AnalysisService', title='Ecoli', Keyword='ECO', Accredited=True,
         Price='409')
     self.service2 = self.addthing(
         self.portal.bika_setup.bika_analysisservices,
         'AnalysisService', title='Oxygen', Keyword='O', Price='410')
     # Cancel one service
     wf = self.portal.portal_workflow
     wf.doActionFor(self.service1, 'deactivate')
     self.service1.reindexObject(idxs=['inactive_state'])
     transaction.commit()
    def test_delete_confirmation_if_locked(self):
        folder = self.portal['f1']
        lockable = ILockable.providedBy(folder)

        form = getMultiAdapter(
            (folder, self.request), name='delete_confirmation')
        form.update()

        self.assertFalse(form.is_locked)

        if lockable:
            lockable.lock()

        form = getMultiAdapter(
            (folder, self.request), name='delete_confirmation')
        form.update()

        self.assertFalse(form.is_locked)

        # After switching the user it should not be possible to delete the
        # object. Of course this is only possible if our context provides
        # ILockable interface.
        if lockable:
            logout()
            login(self.portal, 'editor')

            form = getMultiAdapter(
                (folder, self.request), name='delete_confirmation')
            form.update()
            self.assertTrue(form.is_locked)

            logout()
            login(self.portal, TEST_USER_NAME)

            ILockable(folder).unlock()
Ejemplo n.º 30
0
    def setUp(self):
        self.portal = self.layer['portal']
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        login(self.portal, TEST_USER_NAME)

        self.workspace = create(Builder('workspace'))
        self.view = self.workspace.restrictedTraverse('@@overview_sublisting')
Ejemplo n.º 31
0
    def setUp(self):
        super(TestCalculations, self).setUp()
        setRoles(self.portal, TEST_USER_ID, ['Member', 'LabManager'])
        login(self.portal, TEST_USER_NAME)

        # Calculation: Total Hardness
        # Initial formula: [Ca] + [Mg]
        calcs = self.portal.bika_setup.bika_calculations
        self.calculation = [
            calcs[k] for k in calcs if calcs[k].title == 'Total Hardness'
        ][0]

        # Service with calculation: Tot. Hardness (THCaCO3)
        servs = self.portal.bika_setup.bika_analysisservices
        self.calcservice = [
            servs[k] for k in servs
            if servs[k].title == 'Tot. Hardness (THCaCO3)'
        ][0]
        self.assertEqual(self.calcservice.getCalculation(), self.calculation)
        self.calcservice.setUseDefaultCalculation(False)

        # Analysis Services: Ca and Mg
        self.services = [
            servs[k] for k in servs if servs[k].getKeyword() in ('Ca', 'Mg')
        ]

        # Allow Manual DLs
        for s in self.services:
            s.setLowerDetectionLimit('10')
            s.setUpperDetectionLimit('20')
            s.setDetectionLimitSelector(True)
            s.setAllowManualDetectionLimit(True)

        # Formulas to test
        # Ca and Mg detection Limits: LDL: 10, UDL: 20
        self.formulas = [
            {
                'formula': '[Ca]+[Mg]',
                'analyses': {
                    'Ca': '10',
                    'Mg': '15'
                },
                'interims': {},
                'exresult': '25'
            },
            {
                'formula': '[Ca]+[Mg]',
                'analyses': {
                    'Ca': '-20',
                    'Mg': '5'
                },
                'interims': {},
                'exresult': '-15'
            },
            {
                'formula': '[Ca]+[Mg]+[IN1]',
                'analyses': {
                    'Ca': '10',
                    'Mg': '15'
                },
                'interims': {
                    'IN1': '2'
                },
                'exresult': '27'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '5',
                    'Mg': '1'
                },
                'interims': {
                    'IN1': '5'
                },
                'exresult': '15'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '10',
                    'Mg': '1'
                },
                'interims': {
                    'IN1': '5'
                },
                'exresult': '16'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '10',
                    'Mg': '2'
                },
                'interims': {
                    'IN1': '5'
                },
                'exresult': '17'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '15',
                    'Mg': '2'
                },
                'interims': {
                    'IN1': '5'
                },
                'exresult': '22'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '15',
                    'Mg': '3'
                },
                'interims': {
                    'IN1': '5'
                },
                'exresult': '23'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '20',
                    'Mg': '3'
                },
                'interims': {
                    'IN1': '5'
                },
                'exresult': '28'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '20',
                    'Mg': '3'
                },
                'interims': {
                    'IN1': '10'
                },
                'exresult': '33'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '30',
                    'Mg': '3'
                },
                'interims': {
                    'IN1': '10'
                },
                'exresult': '50'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '>30',
                    'Mg': '5'
                },
                'interims': {
                    'IN1': '10'
                },
                'exresult': '60'
            },
            {
                'formula':
                '([Ca]+[Ca.LDL]) if [Ca.BELOWLDL] else (([Ca.UDL] + [Ca]) if [Ca.ABOVEUDL] else [Ca.RESULT] + [Mg] + [IN1])',
                'analyses': {
                    'Ca': '<5',
                    'Mg': '5'
                },
                'interims': {
                    'IN1': '10'
                },
                'exresult': '10'
            },
        ]
        # New formulas for precision testing
        self.formulas_precision = [
            {
                'formula':
                '[Ca]/[Mg]',
                'analyses': {
                    'Ca': '10',
                    'Mg': '15'
                },
                'interims': {},
                'test_fixed_precision': [
                    {
                        'fixed_precision': 5,
                        'expected_result': '0.66667',
                    },
                    {
                        'fixed_precision': 2,
                        'expected_result': '0.67'
                    },
                    {
                        'fixed_precision': 1,
                        'expected_result': '0.7'
                    },
                    {
                        'fixed_precision': 0,
                        'expected_result': '1'
                    },
                    {
                        'fixed_precision': -1,
                        'expected_result': '1'
                    },
                    {
                        'fixed_precision': -5,
                        'expected_result': '1'
                    },
                ],
                'test_uncertainties_precision': [
                    {
                        'uncertainties': [
                            {
                                'intercept_min': 0,
                                'intercept_max': 10,
                                'errorvalue': 0.056
                            },
                        ],
                        'expected_result':
                        '0.67'
                    },
                    {
                        'uncertainties': [{
                            'intercept_min': 0.002,
                            'intercept_max': 20,
                            'errorvalue': 0.1
                        }],
                        'expected_result':
                        '0.7'
                    },
                ],
            },
            {
                'formula':
                '[Ca]/[Mg]*[IN1]',
                'analyses': {
                    'Ca': '100',
                    'Mg': '20'
                },
                'interims': {
                    'IN1': '0.12'
                },
                'test_fixed_precision': [
                    {
                        'fixed_precision': 5,
                        'expected_result': '0.60000',
                    },
                    {
                        'fixed_precision': 2,
                        'expected_result': '0.60'
                    },
                    {
                        'fixed_precision': 1,
                        'expected_result': '0.6'
                    },
                    {
                        'fixed_precision': 0,
                        'expected_result': '1'
                    },
                    {
                        'fixed_precision': -1,
                        'expected_result': '1'
                    },
                    {
                        'fixed_precision': -5,
                        'expected_result': '1'
                    },
                ],
                'test_uncertainties_precision': [
                    {
                        'uncertainties': [{
                            'intercept_min': 0,
                            'intercept_max': 10,
                            'errorvalue': 0.1
                        }, {
                            'intercept_min': 11,
                            'intercept_max': 20,
                            'errorvalue': 0.056
                        }],
                        'expected_result':
                        '0.6'
                    },
                    {
                        'uncertainties': [{
                            'intercept_min': 0.1,
                            'intercept_max': 0.6,
                            'errorvalue': 0.1
                        }, {
                            'intercept_min': 0.66,
                            'intercept_max': 20,
                            'errorvalue': 0.056
                        }],
                        'expected_result':
                        '0.6',
                    },
                ],
            },
            {
                'formula':
                '[Ca]/[Mg]',
                'analyses': {
                    'Ca': '10',
                    'Mg': 1
                },
                'interims': {},
                'test_fixed_precision': [
                    {
                        'fixed_precision': 5,
                        'expected_result': '10.00000',
                    },
                    {
                        'fixed_precision': 2,
                        'expected_result': '10.00'
                    },
                    {
                        'fixed_precision': 1,
                        'expected_result': '10.0'
                    },
                    {
                        'fixed_precision': 0,
                        'expected_result': '10'
                    },
                    {
                        'fixed_precision': -1,
                        'expected_result': '10'
                    },
                    {
                        'fixed_precision': -5,
                        'expected_result': '10'
                    },
                ],
                'test_uncertainties_precision': [
                    {
                        'uncertainties': [{
                            'intercept_min': 0,
                            'intercept_max': 10,
                            'errorvalue': 0.1
                        }, {
                            'intercept_min': 11,
                            'intercept_max': 20,
                            'errorvalue': 0.056
                        }],
                        'expected_result':
                        '10.0'
                    },
                ],
            },
            {
                'formula':
                '[Ca]/[Mg]',
                'analyses': {
                    'Ca': '1',
                    'Mg': '20'
                },
                'interims': {},
                'test_fixed_precision': [
                    {
                        'fixed_precision': 5,
                        'expected_result': '0.05000',
                    },
                    {
                        'fixed_precision': 2,
                        'expected_result': '0.05'
                    },
                    {
                        'fixed_precision': 1,
                        'expected_result': '0.1'
                    },
                    {
                        'fixed_precision': 0,
                        'expected_result': '0'
                    },
                    {
                        'fixed_precision': -1,
                        'expected_result': '0'
                    },
                    {
                        'fixed_precision': -5,
                        'expected_result': '0'
                    },
                ],
                'test_uncertainties_precision': [
                    {
                        'uncertainties': [{
                            'intercept_min': 0,
                            'intercept_max': 0.01,
                            'errorvalue': 0.01
                        }, {
                            'intercept_min': 11,
                            'intercept_max': 20,
                            'errorvalue': 0.056
                        }],
                        'expected_result':
                        '0.05'
                    },
                ],
            },
            {
                'formula':
                '([Ca]/[Mg])+0.000001',
                'analyses': {
                    'Ca': '1',
                    'Mg': '20'
                },
                'interims': {},
                'test_fixed_precision': [
                    {
                        'fixed_precision': 6,
                        'expected_result': '0.050001',
                    },
                ],
                'test_uncertainties_precision': [
                    {
                        'uncertainties': [
                            {
                                'intercept_min': 0,
                                'intercept_max': 0.09,
                                'errorvalue': 0
                            },
                        ],
                        'expected_result':
                        '0.050001'
                    },
                ],
            },
        ]
Ejemplo n.º 32
0
 def getSubscriptions(data={}, user=USER_A_ID):
     login(self.layer['portal'], user)
     return self.layer['portal'].unrestrictedTraverse(
         'quizdb-subscriptions').asDict(data)
Ejemplo n.º 33
0
 def setUpPloneSite(self, portal):
     login(portal, TEST_USER_NAME)
     # Install into Plone site using portal_setup
     applyProfile(portal, 'ftw.slider:default')
     if IS_PLONE_5:
         applyProfile(portal, 'plone.app.contenttypes:default')
Ejemplo n.º 34
0
 def test_editor_cannot_convert(self):
     login(self.portal, "editor")
     self.assertFalse(self.unconverted_assign_team_view.can_convert)
Ejemplo n.º 35
0
 def test_add_form_does_not_affect_non_layout_aware(self):
     login(self.portal, TEST_USER_NAME)
     view = self._get_add_view(self.portal, 'Link')
     view.form_instance.updateFieldsFromSchemata()
     self.assertNotEqual(len(view.form_instance.groups), 0)
     self.assertNotEqual(len(view.form_instance.fields), 2)
Ejemplo n.º 36
0
 def setUp(self):
     super(TestAddDuplicateAnalysis, self).setUp()
     setRoles(self.portal, TEST_USER_ID, ['Member', 'LabManager'])
     login(self.portal, TEST_USER_NAME)
Ejemplo n.º 37
0
 def setUpUser(self):
     setRoles(self.portal, TEST_USER_ID, ['Manager', 'Editor', 'Reviewer'])
     login(self.portal, TEST_USER_NAME)
 def setUp(self):
     self.app = self.layer['app']
     self.portal = self.layer['portal']
     self.portal_url = self.portal.absolute_url()
     setRoles(self.portal, TEST_USER_ID, ['Member'])
     login(self.portal, SITE_OWNER_NAME)
Ejemplo n.º 39
0
    def setUpPloneSite(self, portal):
        catalog = getToolByName(portal, 'portal_catalog')
        applyProfile(portal, 'ric.core:testing')

        position_types = [{
            'name': u'Secretaire',
            'token': 'secretaire'
        }, {
            'name': u'President',
            'token': 'president'
        }]
        organization_types = [{
            'name': u'ASBL',
            'token': 'asbl'
        }, {
            'name': u'PME',
            'token': 'pme'
        }]
        organization_levels = [{
            'name': u'Info',
            'token': 'info'
        }, {
            'name': u'Secretariat',
            'token': 'secretariat'
        }]

        old_user_properties = {'last_login_time': DateTime(2000, 1, 1)}
        api.user.create(email='*****@*****.**',
                        username='******',
                        properties=old_user_properties)

        new_user_properties = {'last_login_time': DateTime()}
        api.user.create(email='*****@*****.**',
                        username='******',
                        properties=new_user_properties)

        setRoles(portal, TEST_USER_ID, ['Manager'])
        login(portal, TEST_USER_NAME)
        annuaire = api.content.create(type='directory',
                                      title='Annuaire',
                                      position_types=position_types,
                                      organization_types=organization_types,
                                      organization_levels=organization_levels,
                                      id='annuaire',
                                      container=portal)

        affinitic = api.content.create(type='organization',
                                       title='Affinitic',
                                       id='affinitic',
                                       subscriptions=[{
                                           'year': 2014,
                                           'payment': False
                                       }, {
                                           'year': 2013,
                                           'payment': True
                                       }],
                                       email='*****@*****.**',
                                       citizen=100,
                                       servers='Linux',
                                       softwares='Firefox',
                                       description='Affinitic description',
                                       organization_type='asbl',
                                       phone='071123456',
                                       cell_phone='0488123456',
                                       fax='321123456',
                                       website='www.affinitic.be',
                                       number='3',
                                       street='random street',
                                       city='random city',
                                       region='random region',
                                       container=annuaire,
                                       use_parent_address=False)
        tintin = api.content.create(
            type='person',
            title='Tintin',
            id='tintin',
            email='*****@*****.**',
            multimail=['contact_cotisation', 'formation'],
            invalidmail=True,
            userid='tintin',
            password='******',
            confirm_password='******',
            lastname='Tin',
            firstname='Tin',
            birthday=datetime(1987, 6, 25),
            phone='071123456',
            cell_phone='0488123456',
            fax='321123456',
            website='www.affinitic.be',
            number='26',
            street='rue du Labrador',
            additional_address_details='fictif',
            zip_code='1000',
            city='Bruxelles',
            region='Bruxelles',
            container=affinitic)
        haddock = api.content.create(type='person',
                                     title='Haddock',
                                     id='haddock',
                                     email='*****@*****.**',
                                     multimail=[],
                                     invalidmail=False,
                                     userid='haddock',
                                     password='******',
                                     confirm_password='******',
                                     lastname='Haddock',
                                     container=affinitic)

        imio = api.content.create(type='organization',
                                  title='Imio',
                                  id='imio',
                                  subscriptions=[{
                                      'year': 2014,
                                      'payment': False
                                  }, {
                                      'year': 2013,
                                      'payment': False
                                  }],
                                  email='*****@*****.**',
                                  citizen=100,
                                  servers='Linux',
                                  softwares='Firefox',
                                  container=annuaire,
                                  use_parent_address=False)
        dupont = api.content.create(type='person',
                                    title='Dupont',
                                    id='dupont',
                                    email='*****@*****.**',
                                    multimail=['formation'],
                                    invalidmail=False,
                                    userid='dupont',
                                    password='******',
                                    confirm_password='******',
                                    lastname='Dupont',
                                    birthday=datetime(1980, 1, 1),
                                    container=imio)

        catalog.reindexObject(annuaire)
        catalog.reindexObject(affinitic)
        catalog.reindexObject(tintin)
        catalog.reindexObject(haddock)
        catalog.reindexObject(imio)
        catalog.reindexObject(dupont)
Ejemplo n.º 40
0
 def setUp(self):
     super(TestCaseMixin, self).setUp()
     self.folders_by_path = {}
     pa_testing.setRoles(self.portal, pa_testing.TEST_USER_ID, [b'Manager'])
     pa_testing.login(self.portal, pa_testing.TEST_USER_NAME)
    def test_collection_templates(self):
        self.portal.acl_users.userFolderAddUser(
            SITE_OWNER_NAME, SITE_OWNER_PASSWORD, ['Manager'], [])
        browser = self.browser
        portal = self.portal
        login(portal, SITE_OWNER_NAME)
        # add an image that will be listed by the collection
        portal.invokeFactory('Image',
                             'image',
                             title='Image example')

        image = self.portal['image']
        image.image = dummy_image()

        # add a collection, so we can add a query to it
        portal.invokeFactory('Collection',
                             'collection',
                             title='New Collection')
        collection = portal['collection']
        # Search for images
        query = [{
            'i': 'Type',
            'o': 'plone.app.querystring.operation.string.is',
            'v': 'Image',
        }]
        collection.text = RichTextValue(
            u'Lorem collection ipsum',
            'text/plain',
            'text/html'
        )

        wrapped = ICollection_behavior(collection)
        # set the query and publish the collection
        wrapped.query = query
        workflow = portal.portal_workflow
        workflow.doActionFor(collection, 'publish')
        commit()
        logout()
        # open a browser to see if our image is in the results
        browser.handleErrors = False
        url = collection.absolute_url()
        browser.open(url)
        self.assertIn('Lorem collection ipsum', browser.contents)
        self.assertIn('Image example', browser.contents)

        # open summary_view template
        browser.open('{0}/@@summary_view'.format(url))
        self.assertIn('Lorem collection ipsum', browser.contents)
        self.assertIn('Image example', browser.contents)

        # open full_view template
        browser.open('{0}/@@full_view'.format(url))
        self.assertIn('Lorem collection ipsum', browser.contents)
        self.assertIn('Image example', browser.contents)

        # open tabular_view template
        browser.open('{0}/@@tabular_view'.format(url))
        self.assertIn('Lorem collection ipsum', browser.contents)
        self.assertIn('Image example', browser.contents)

        # open thumbnail_view template
        browser.open('{0}/@@album_view'.format(url))
        self.assertIn('Lorem collection ipsum', browser.contents)
        self.assertIn('Image example', browser.contents)
Ejemplo n.º 42
0
 def tearDown(self):
     super(Test_ShowPrices, self).setUp()
     login(self.portal, TEST_USER_NAME)
Ejemplo n.º 43
0
 def setUp(self):
     super(TestInstrumentAlerts, self).setUp()
     login(self.portal, TEST_USER_NAME)
 def setUp(self):
     self.portal = self.layer['portal']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
     self.portal.invokeFactory('Collection', 'collection')
     self.collection = self.portal['collection']
Ejemplo n.º 45
0
 def tearDownPloneSite(self, portal):
     setRoles(portal, TEST_USER_ID, ['Manager'])
     login(portal, TEST_USER_NAME)
     portal.manage_delObjects('test-folder')
     setRoles(portal, TEST_USER_ID, ['Member'])
Ejemplo n.º 46
0
 def createObject(self, obj_type, obj_id):
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
     return self.portal.invokeFactory(obj_type, id=obj_id)
Ejemplo n.º 47
0
 def tearDown(self):
     super(TestInstrumentImport, self).setUp()
     login(self.portal, TEST_USER_NAME)
 def setUp(self):
     self.portal = self.layer['portal']
     self.folder = self.portal['folder']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
Ejemplo n.º 49
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     login(self.portal, TEST_USER_NAME)
     setRoles(self.portal, TEST_USER_ID, ('Member', 'Manager'))
Ejemplo n.º 50
0
 def _loginAsManager(self):
     login(self.portal, TEST_USER_NAME)
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
Ejemplo n.º 51
0
 def setUp(self):
     setRoles(self.layer['portal'], TEST_USER_ID, ['Manager'])
     login(self.layer['portal'], TEST_USER_NAME)
Ejemplo n.º 52
0
 def setUpPloneSite(self, portal):
     login(portal, TEST_USER_NAME)
     # Install into Plone site using portal_setup
     applyProfile(portal, 'ftw.slider:default')
Ejemplo n.º 53
0
 def tearDown(self):
     super(TestARImports, self).setUp()
     login(self.portal, TEST_USER_NAME)
Ejemplo n.º 54
0
 def setUpPloneSite(self, portal):
     self.applyProfile(portal, 'bda.plone.discount:default')
     setRoles(portal, TEST_USER_ID, ['Manager'])
     login(portal, TEST_USER_NAME)
Ejemplo n.º 55
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     self.wftool = getToolByName(self.portal, 'portal_workflow')
     login(self.portal, SITE_OWNER_NAME)
     self.portal.invokeFactory('Document', id='doc1')
Ejemplo n.º 56
0
 def tearDownPloneSite(self, portal):
     login(portal, 'admin')
     portal.manage_delObjects([TEST_FOLDER_ID])
     super(PloneAppContenttypesRobot, self).tearDownPloneSite(portal)
Ejemplo n.º 57
0
 def test_available_folders_as_lambda(self):
     login(self.portal, "user2")
     source = ClassificationFolderSource(self.portal)
     terms = [(term.value, term.title) for term in source]
     self.assertEqual([], terms)
Ejemplo n.º 58
0
 def setUp(self):
     portal = self.layer['portal']
     login(portal, TEST_USER_NAME)
Ejemplo n.º 59
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.app = self.layer['app']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
Ejemplo n.º 60
0
 def test_available_folders_as_groupmember(self):
     login(self.portal, "user1")
     source = ClassificationFolderSource(self.portal)
     terms = [(term.value, term.title) for term in source]
     self.assertEqual([(self.folder1_uid, u"Folder 1")], terms)