コード例 #1
0
ファイル: ftests.py プロジェクト: wpjunior/proled
    def test_cutpaste_duplicated_id_object(self):

        root = self.getRootFolder()

        # Create a principal Folder
        root['pf'] = PrincipalFolder()
        pf = root['pf']

        # Create a principal with p1 as login
        principal = Principal('p1')
        principal.login = '******'
        directlyProvides(principal, IInternalPrincipal)

        pf['p1'] = principal

        transaction.commit()
        self.assertEqual(len(pf.keys()), 1)
        #raise str([x for x in pf.keys()])

        response = self.publish('/pf/@@contents.html',
                                basic='mgr:mgrpw',
                                form={'ids': [u'p1'],
                                      'container_cut_button': u'Cut'})
        self.assertEqual(response.getStatus(), 302)


        # Try to paste the file
        try:
            response = self.publish('/pf/@@contents.html',
                                    basic='mgr:mgrpw',
                                    form={'container_paste_button': ''})
        except UserError, e:
            self.assertEqual(
                str(e),
                "The given name(s) [u'p1'] is / are already being used")
コード例 #2
0
    def handle_register(self, action):
        request = self.request

        data, errors = self.extractData()

        if not errors:
            principal = Principal(data['id'], data['title'], '')
            interface.alsoProvides(principal, IMailAuthorizationAware)

            auth = getUtility(IAuthentication)

            users = queryUtility(IAuthenticatorPlugin, 'users')

            if users is not None:
                id = 1
                while str(id) in users:
                    id = id + 1

                users[str(id)] = InternalPrincipal(
                    data['id'], '12345', data['title'])

                principal.id = auth.prefix + users.prefix + str(id)

            status = getUtility(IPortalRegistration).registerPrincipal(
                principal, request)
            if status == STATUS_CONTINUE:
                self.redirect('/test.html')

            # IMemberRegistrationForm attribute
            self.registeredPrincipal = principal
コード例 #3
0
ファイル: tests.py プロジェクト: bendavis78/zope
    def test_cutpaste_duplicated_id_object(self):

        root = self.getRootFolder()

        # Create a principal Folder
        root['pf'] = PrincipalFolder()
        pf = root['pf']

        # Create a principal with p1 as login
        principal = Principal('p1')
        principal.login = '******'
        directlyProvides(principal, IInternalPrincipal)

        pf['p1'] = principal

        transaction.commit()
        self.assertEqual(len(pf.keys()), 1)
        #raise str([x for x in pf.keys()])

        response = self.publish('/pf/@@contents.html',
                                basic='mgr:mgrpw',
                                form={
                                    'ids': [u'p1'],
                                    'container_cut_button': u'Cut'
                                })
        self.assertEqual(response.getStatus(), 302)

        # Try to paste the file
        try:
            response = self.publish('/pf/@@contents.html',
                                    basic='mgr:mgrpw',
                                    form={'container_paste_button': ''})
        except UserError, e:
            self.assertEqual(
                str(e),
                "The given name(s) [u'p1'] is / are already being used")