Example #1
0
    def perform_post_submission_actions(self):
        commentCreation = {
            'content': 'comment!',
        }

        messageCreation = {
            'content': 'message!',
        }

        self.dummyRTips = yield self.get_rtips()

        for rtip_desc in self.dummyRTips:
            yield rtip.create_comment_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               commentCreation)

            yield rtip.create_message_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               messageCreation)

        self.dummyWBTips = yield self.get_wbtips()

        for wbtip_desc in self.dummyWBTips:
            yield wbtip.create_comment_wb(wbtip_desc['wbtip_id'],
                                          commentCreation)

            for receiver_id in wbtip_desc['wbtip_receivers']:
                yield wbtip.create_message_wb(wbtip_desc['wbtip_id'], receiver_id, messageCreation)
Example #2
0
    def perform_submission(self):

        self.dummySubmission['context_id'] = self.dummyContext['id']
        self.dummySubmission['receivers'] = self.dummyContext['receivers']
        self.dummySubmission['wb_steps'] = yield fill_random_fields(self.dummyContext['id'])
        self.dummySubmission = yield create_submission(self.dummySubmission, False, 'en')

        yield self.emulate_file_upload(self.dummySubmission['id'])
        submission = yield update_submission(self.dummySubmission['id'], self.dummySubmission, True, 'en')
        self.dummyWBTip = yield create_whistleblower_tip(self.dummySubmission)

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()

        commentCreation = {
            'content': 'comment!',
        }

        messageCreation = {
            'content': 'message!',
        }

        rtips_desc = yield self.get_rtips()

        for rtip_desc in rtips_desc:
            yield rtip.create_comment_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               commentCreation)

            yield rtip.create_message_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               messageCreation)

        wbtips_desc = yield self.get_wbtips()

        for wbtip_desc in wbtips_desc:
            yield wbtip.create_comment_wb(wbtip_desc['wbtip_id'],
                                          commentCreation)

            for receiver_id in wbtip_desc['wbtip_receivers']:
                yield wbtip.create_message_wb(wbtip_desc['wbtip_id'], receiver_id, messageCreation)

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()
Example #3
0
    def perform_post_submission_actions(self):
        commentCreation = {
            'content': 'comment!',
        }

        messageCreation = {
            'content': 'message!',
        }

        identityaccessrequestCreation = {
            'request_motivation': 'request motivation'
        }

        self.dummyRTips = yield self.get_rtips()

        for rtip_desc in self.dummyRTips:
            yield rtip.create_comment_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['id'],
                                               commentCreation)

            yield rtip.create_message_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['id'],
                                               messageCreation)

            yield self.emulate_file_append(rtip_desc['id'], 3)

            yield rtip.create_identityaccessrequest(rtip_desc['receiver_id'],
                                                    rtip_desc['id'],
                                                    identityaccessrequestCreation,
                                                    'en')

        self.dummyWBTips = yield self.get_wbtips()

        for wbtip_desc in self.dummyWBTips:
            yield wbtip.create_comment_wb(wbtip_desc['id'],
                                          commentCreation)

            for receiver_id in wbtip_desc['receivers_ids']:
                yield wbtip.create_message_wb(wbtip_desc['id'], receiver_id, messageCreation)
Example #4
0
    def wb_RW_comments(self):
        self.commentCreation['content'] = unicode("I'm a WB comment")
        yield wbtip.create_comment_wb(self.wb_tip_id, self.commentCreation)

        cl = yield wbtip.get_comment_list_wb(self.wb_tip_id)
        self.assertEqual(len(cl), 3)
Example #5
0
    def wb_RW_comments(self):
        self.commentCreation['content'] = unicode("I'm a WB comment")
        yield wbtip.create_comment_wb(self.wb_tip_id, self.commentCreation)

        cl = yield wbtip.get_comment_list_wb(self.wb_tip_id)
        self.assertEqual(len(cl), 3)
Example #6
0
    def fill_data(self):
        try:
            yield do_appdata_init()

        except Exception as excp:
            print "Fail fill_data/do_appdata_init: %s" % excp
            raise  excp

        receivers_ids = []

        try:
            self.dummyReceiver_1 = yield create_receiver(self.dummyReceiver_1)
            receivers_ids.append(self.dummyReceiver_1['id'])
            self.dummyReceiver_2 = yield create_receiver(self.dummyReceiver_2)
            receivers_ids.append(self.dummyReceiver_2['id'])
        except Exception as excp:
            print "Fail fill_data/create_receiver: %s" % excp
            raise  excp

        try:
            self.dummyContext['receivers'] = receivers_ids
            self.dummyContext = yield create_context(self.dummyContext)
        except Exception as excp:
            print "Fail fill_data/create_context: %s" % excp
            raise  excp

        self.dummySubmission['context_id'] = self.dummyContext['id']
        self.dummySubmission['receivers'] = receivers_ids
        self.dummySubmission['wb_fields'] = fill_random_fields(self.dummyContext)

        try:
            self.dummySubmissionNotFinalized = yield create_submission(self.dummySubmission, finalize=False)
        except Exception as excp:
            print "Fail fill_data/create_submission: %s" % excp
            raise  excp

        try:
            self.dummySubmission = yield create_submission(self.dummySubmission, finalize=False)
        except Exception as excp:
            print "Fail fill_data/create_submission: %s" % excp
            raise  excp

        yield self.emulate_file_upload(self.dummySubmission['id'])

        try:
            submission = yield update_submission(self.dummySubmission['id'], self.dummySubmission, finalize=True)
        except Exception as excp:
            print "Fail fill_data/update_submission: %s" % excp
            raise  excp

        try:
            self.dummyWBTip = yield create_whistleblower_tip(self.dummySubmission)
        except Exception as excp:
            print "Fail fill_data/create_whistleblower: %s" % excp
            raise  excp

        assert self.dummyReceiver_1.has_key('id')
        assert self.dummyReceiver_2.has_key('id')
        assert self.dummyContext.has_key('id')
        assert self.dummySubmission.has_key('id')

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()

        commentCreation = {
            'content': 'comment!',
        }

        messageCreation = {
            'content': 'message!',
        }

        rtips_desc = yield self.get_rtips()

        for rtip_desc in rtips_desc:
            yield rtip.create_comment_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               commentCreation)

            yield rtip.create_message_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               messageCreation)


        wbtips_desc = yield self.get_wbtips()

        for wbtip_desc in wbtips_desc: 
            yield wbtip.create_comment_wb(wbtip_desc['wbtip_id'],
                                          commentCreation)

            for receiver_id in wbtip_desc['wbtip_receivers']:
                yield wbtip.create_message_wb(wbtip_desc['wbtip_id'], receiver_id, messageCreation)

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()
Example #7
0
    def fill_data(self):
        try:
            yield do_appdata_init()

        except Exception as excp:
            print "Fail fill_data/do_appdata_init: %s" % excp
            raise excp

        receivers_ids = []

        try:
            self.dummyReceiver_1 = yield create_receiver(self.dummyReceiver_1)
            receivers_ids.append(self.dummyReceiver_1['id'])
            self.dummyReceiver_2 = yield create_receiver(self.dummyReceiver_2)
            receivers_ids.append(self.dummyReceiver_2['id'])
        except Exception as excp:
            print "Fail fill_data/create_receiver: %s" % excp
            raise excp

        try:
            self.dummyContext['receivers'] = receivers_ids
            self.dummyContext = yield create_context(self.dummyContext)
        except Exception as excp:
            print "Fail fill_data/create_context: %s" % excp
            raise excp

        self.dummySubmission['context_id'] = self.dummyContext['id']
        self.dummySubmission['receivers'] = receivers_ids
        self.dummySubmission['wb_fields'] = fill_random_fields(
            self.dummyContext)

        try:
            self.dummySubmissionNotFinalized = yield create_submission(
                self.dummySubmission, finalize=False)
        except Exception as excp:
            print "Fail fill_data/create_submission: %s" % excp
            raise excp

        try:
            self.dummySubmission = yield create_submission(
                self.dummySubmission, finalize=False)
        except Exception as excp:
            print "Fail fill_data/create_submission: %s" % excp
            raise excp

        yield self.emulate_file_upload(self.dummySubmission['id'])

        try:
            submission = yield update_submission(self.dummySubmission['id'],
                                                 self.dummySubmission,
                                                 finalize=True)
        except Exception as excp:
            print "Fail fill_data/update_submission: %s" % excp
            raise excp

        try:
            self.dummyWBTip = yield create_whistleblower_tip(
                self.dummySubmission)
        except Exception as excp:
            print "Fail fill_data/create_whistleblower: %s" % excp
            raise excp

        assert self.dummyReceiver_1.has_key('id')
        assert self.dummyReceiver_2.has_key('id')
        assert self.dummyContext.has_key('id')
        assert self.dummySubmission.has_key('id')

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()

        commentCreation = {
            'content': 'comment!',
        }

        messageCreation = {
            'content': 'message!',
        }

        rtips_desc = yield self.get_rtips()

        for rtip_desc in rtips_desc:
            yield rtip.create_comment_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               commentCreation)

            yield rtip.create_message_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               messageCreation)

        wbtips_desc = yield self.get_wbtips()

        for wbtip_desc in wbtips_desc:
            yield wbtip.create_comment_wb(wbtip_desc['wbtip_id'],
                                          commentCreation)

            for receiver_id in wbtip_desc['wbtip_receivers']:
                yield wbtip.create_message_wb(wbtip_desc['wbtip_id'],
                                              receiver_id, messageCreation)

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()
Example #8
0
    def fill_data(self):
        yield do_appdata_init()

        receivers_ids = []

        # fill_data/create_receiver
        self.dummyReceiver_1 = yield create_receiver(self.dummyReceiver_1)
        receivers_ids.append(self.dummyReceiver_1['id'])
        self.dummyReceiver_2 = yield create_receiver(self.dummyReceiver_2)
        receivers_ids.append(self.dummyReceiver_2['id'])

        # fill_data/create_context
        self.dummyContext['receivers'] = receivers_ids
        self.dummyContext = yield create_context(self.dummyContext)

        # fill_data: create cield templates
        for idx, field in enumerate(self.dummyFieldTemplates):
            f = yield create_field(field, 'en')
            self.dummyFieldTemplates[idx]['id'] = f['id']

        # fill_data: create fields and associate them to the context steps
        for idx, field in enumerate(self.dummyFields):
            field['is_template'] = False
            if idx <= 2:
                # "Field 1", "Field 2" and "Generalities" are associated to the first step
                field['step_id'] = self.dummyContext['steps'][0]['id']
            else:
                # Name, Surname, Gender" are associated to field "Generalities"
                # "Field 1" and "Field 2" are associated to the first step
                field['fieldgroup_id'] = self.dummyFields[2]['id']
               
            f = yield create_field(field, 'en')
            self.dummyFields[idx]['id'] = f['id']

        self.dummyContext['steps'][0]['children'] = [
            self.dummyFields[0], # Field 1
            self.dummyFields[1], # Field 2
            self.dummyFields[2]  # Generalities
        ]

        yield update_context(self.dummyContext['id'], self.dummyContext)

        # fill_data/create_submission
        self.dummySubmission['context_id'] = self.dummyContext['id']
        self.dummySubmission['receivers'] = receivers_ids
        self.dummySubmission['wb_steps'] = yield fill_random_fields(self.dummyContext['id'])
        self.dummySubmissionNotFinalized = yield create_submission(self.dummySubmission, finalize=False)
        self.dummySubmission = yield create_submission(self.dummySubmission, finalize=False)

        yield self.emulate_file_upload(self.dummySubmission['id'])
        # fill_data/update_submssion
        submission = yield update_submission(self.dummySubmission['id'], self.dummySubmission, finalize=True)
        # fill_data/create_whistleblower
        self.dummyWBTip = yield create_whistleblower_tip(self.dummySubmission)

        assert self.dummyReceiver_1.has_key('id')
        assert self.dummyReceiver_2.has_key('id')
        assert self.dummyContext.has_key('id')
        assert self.dummySubmission.has_key('id')

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()

        commentCreation = {
            'content': 'comment!',
        }

        messageCreation = {
            'content': 'message!',
        }

        rtips_desc = yield self.get_rtips()

        for rtip_desc in rtips_desc:
            yield rtip.create_comment_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               commentCreation)

            yield rtip.create_message_receiver(rtip_desc['receiver_id'],
                                               rtip_desc['rtip_id'],
                                               messageCreation)


        wbtips_desc = yield self.get_wbtips()

        for wbtip_desc in wbtips_desc:
            yield wbtip.create_comment_wb(wbtip_desc['wbtip_id'],
                                          commentCreation)

            for receiver_id in wbtip_desc['wbtip_receivers']:
                yield wbtip.create_message_wb(wbtip_desc['wbtip_id'], receiver_id, messageCreation)

        yield delivery_sched.DeliverySchedule().operation()
        yield notification_sched.NotificationSchedule().operation()