예제 #1
0
    def test_confirmation(self):
        portal = self.layer['portal']
        app = self.layer['app']
        z2.login(app['acl_users'], SITE_OWNER_NAME)
        self.register_users()
        event = self._create_event()
        data = {
            'internal_attendees': ['max-musterman', 'john-doe','Administrators', 'Reviewers'],
            'external_attendees': [{'name':'John Smith', 
                                    'email':'*****@*****.**',}],
        }
        utils.save_attendees(event, data)
        storage = IAttendeesStorage(event)

        login(portal, 'max-musterman')
        utils.save_confirmation(event, 'Yes')
        usernames = [i['id'] for i in storage.internal_attendees]
        self.assertTrue('max-musterman' in usernames)
        self.assertEqual(
                storage.internal_attendees[usernames.index('max-musterman')]['attending'],
                'Yes')
        self.assertEqual(utils.get_confirmation(event), 'Yes')

        utils.save_confirmation(event, 'No')
        self.assertEqual(utils.get_confirmation(event), 'No')

        utils.save_confirmation(event, 'Maybe')
        self.assertEqual(utils.get_confirmation(event), 'Maybe')

        login(portal, 'john-doe')
        utils.save_confirmation(event, 'Maybe')
        self.assertEqual(utils.get_confirmation(event), 'Maybe')

        utils.save_confirmation(event, 'No')
        self.assertEqual(utils.get_confirmation(event), 'No')
예제 #2
0
 def save_confirmation(self, action):
     data, errors = self.extractData()
     if errors:
         self.status = '\n'.join([error.error.__str__() for error in errors])
         return 
     context = aq_inner(self.context)
     utils.save_confirmation(context, data['attending'])
     addStatusMessage(self.request, 
                     "Thank you for confirming.", type='info')
     self.request.response.redirect(self.context.REQUEST.get('URL'))
예제 #3
0
    def test_confirmation_group(self):
        portal = self.layer['portal']
        app = self.layer['app']
        z2.login(app['acl_users'], SITE_OWNER_NAME)
        self.register_users()
        event = self._create_event()
        data = {
            'internal_attendees': ['Reviewers'],
            'external_attendees': [],
        }
        utils.save_attendees(event, data)

        login(portal, 'jan-keller')
        utils.save_confirmation(event, 'Yes')
        self.assertEqual(utils.get_confirmation(event), 'Yes')