コード例 #1
0
    def fill_data(self):
        # fill_data/create_admin
        self.dummyAdmin = yield create_admin(copy.deepcopy(self.dummyAdminUser), 'en')
        self.dummyAdminUser['id'] = self.dummyAdmin['id']

        # fill_data/create_custodian
        self.dummyCustodian = yield create_custodian(copy.deepcopy(self.dummyCustodianUser), 'en')
        self.dummyCustodianUser['id'] = self.dummyCustodian['id']

        # fill_data/create_receiver
        self.dummyReceiver_1 = yield create_receiver(copy.deepcopy(self.dummyReceiver_1), 'en')
        self.dummyReceiverUser_1['id'] = self.dummyReceiver_1['id']
        self.dummyReceiver_2 = yield create_receiver(copy.deepcopy(self.dummyReceiver_2), 'en')
        self.dummyReceiverUser_2['id'] = self.dummyReceiver_2['id']
        receivers_ids = [self.dummyReceiver_1['id'], self.dummyReceiver_2['id']]

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

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

        for idx, field in enumerate(self.dummyFields):
            change_field_type(field, 'instance')
            field['step_id'] = self.dummyContext['steps'][0]['id']
            f = yield create_field(copy.deepcopy(field), 'en', 'import')
            self.dummyFields[idx]['id'] = f['id']

            self.dummyContext['steps'][0]['children'].append(f)

        yield update_context(self.dummyContext['id'], copy.deepcopy(self.dummyContext), 'en')
コード例 #2
0
ファイル: helpers.py プロジェクト: nyimbi/GlobaLeaks
    def fill_data(self):
        yield do_appdata_init()

        # fill_data/create_admin
        self.dummyAdmin = yield create_admin(
            copy.deepcopy(self.dummyAdminUser), 'en')
        self.dummyAdminUser['id'] = self.dummyAdmin['id']

        # fill_data/create_custodian
        self.dummyCustodian = yield create_custodian(
            copy.deepcopy(self.dummyCustodianUser), 'en')
        self.dummyCustodianUser['id'] = self.dummyCustodian['id']
        custodians_ids = [self.dummyCustodian['id']]

        # fill_data/create_receiver
        self.dummyReceiver_1 = yield create_receiver(
            copy.deepcopy(self.dummyReceiver_1), 'en')
        self.dummyReceiverUser_1['id'] = self.dummyReceiver_1['id']
        self.dummyReceiver_2 = yield create_receiver(
            copy.deepcopy(self.dummyReceiver_2), 'en')
        self.dummyReceiverUser_2['id'] = self.dummyReceiver_2['id']
        receivers_ids = [
            self.dummyReceiver_1['id'], self.dummyReceiver_2['id']
        ]

        # fill_data/create_context
        self.dummyContext['custodians'] = custodians_ids
        self.dummyContext['receivers'] = receivers_ids
        self.dummyContext = yield create_context(
            copy.deepcopy(self.dummyContext), 'en')

        # fill_data: create field templates
        for idx, field in enumerate(self.dummyFieldTemplates):
            f = yield create_field(copy.deepcopy(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['instance'] = 'instance'
            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(copy.deepcopy(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'],
                             copy.deepcopy(self.dummyContext), 'en')
コード例 #3
0
ファイル: helpers.py プロジェクト: evilaliv3/GlobaLeaks
    def fill_data(self):
        # fill_data/create_admin
        self.dummyAdmin = yield create_admin(
            copy.deepcopy(self.dummyAdminUser), 'en')
        self.dummyAdminUser['id'] = self.dummyAdmin['id']

        # fill_data/create_custodian
        self.dummyCustodian = yield create_custodian(
            copy.deepcopy(self.dummyCustodianUser), 'en')
        self.dummyCustodianUser['id'] = self.dummyCustodian['id']

        # fill_data/create_receiver
        self.dummyReceiver_1 = yield create_receiver(
            copy.deepcopy(self.dummyReceiver_1), 'en')
        self.dummyReceiverUser_1['id'] = self.dummyReceiver_1['id']
        self.dummyReceiver_2 = yield create_receiver(
            copy.deepcopy(self.dummyReceiver_2), 'en')
        self.dummyReceiverUser_2['id'] = self.dummyReceiver_2['id']
        receivers_ids = [
            self.dummyReceiver_1['id'], self.dummyReceiver_2['id']
        ]

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

        self.dummyQuestionnaire = yield get_questionnaire(
            self.dummyContext['questionnaire_id'], 'en')

        self.dummyQuestionnaire['steps'].append(self.get_dummy_step())
        self.dummyQuestionnaire['steps'][2][
            'questionnaire_id'] = self.dummyContext['questionnaire_id']
        self.dummyQuestionnaire['steps'][2]['label'] = 'Whistleblower identity'
        self.dummyQuestionnaire['steps'][2]['presentation_order'] = 1
        self.dummyQuestionnaire['steps'][2] = yield create_step(
            self.dummyQuestionnaire['steps'][2], 'en')

        if self.complex_field_population:
            yield self.add_whistleblower_identity_field_to_step(
                self.dummyQuestionnaire['steps'][2]['id'])

            self.dummyQuestionnaire['steps'][1]['presentation_order'] = 2
            yield update_step(self.dummyQuestionnaire['steps'][1]['id'],
                              self.dummyQuestionnaire['steps'][1], 'en')

            self.dummyQuestionnaire['steps'] = [
                self.dummyQuestionnaire['steps'][0],
                self.dummyQuestionnaire['steps'][2],
                self.dummyQuestionnaire['steps'][1]
            ]
コード例 #4
0
ファイル: helpers.py プロジェクト: br1n0/GlobaLeaks
    def fill_data(self):
        yield do_appdata_init()

        # fill_data/create_admin
        self.dummyAdmin = yield create_admin(copy.deepcopy(self.dummyAdminUser), 'en')
        self.dummyAdminUser['id'] = self.dummyAdmin['id']

        # fill_data/create_custodian
        self.dummyCustodian = yield create_custodian(copy.deepcopy(self.dummyCustodianUser), 'en')
        self.dummyCustodianUser['id'] = self.dummyCustodian['id']
        custodians_ids = [self.dummyCustodian['id']]

        # fill_data/create_receiver
        self.dummyReceiver_1 = yield create_receiver(copy.deepcopy(self.dummyReceiver_1), 'en')
        self.dummyReceiverUser_1['id'] = self.dummyReceiver_1['id']
        self.dummyReceiver_2 = yield create_receiver(copy.deepcopy(self.dummyReceiver_2), 'en')
        self.dummyReceiverUser_2['id'] = self.dummyReceiver_2['id']
        receivers_ids = [self.dummyReceiver_1['id'], self.dummyReceiver_2['id']]

        # fill_data/create_context
        self.dummyContext['custodians'] = custodians_ids
        self.dummyContext['receivers'] = receivers_ids
        self.dummyContext = yield create_context(copy.deepcopy(self.dummyContext), 'en')

        # fill_data: create field templates
        for idx, field in enumerate(self.dummyFieldTemplates):
            f = yield create_field(copy.deepcopy(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['instance'] = 'instance'
            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(copy.deepcopy(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'], copy.deepcopy(self.dummyContext), 'en')
コード例 #5
0
ファイル: helpers.py プロジェクト: flipchan/GlobaLeaks
    def fill_data(self):
        # fill_data/create_admin
        self.dummyAdmin = yield create_admin(copy.deepcopy(self.dummyAdminUser), 'en')
        self.dummyAdminUser['id'] = self.dummyAdmin['id']

        # fill_data/create_custodian
        self.dummyCustodian = yield create_custodian(copy.deepcopy(self.dummyCustodianUser), 'en')
        self.dummyCustodianUser['id'] = self.dummyCustodian['id']

        # fill_data/create_receiver
        self.dummyReceiver_1 = yield create_receiver(copy.deepcopy(self.dummyReceiver_1), 'en')
        self.dummyReceiverUser_1['id'] = self.dummyReceiver_1['id']
        self.dummyReceiver_2 = yield create_receiver(copy.deepcopy(self.dummyReceiver_2), 'en')
        self.dummyReceiverUser_2['id'] = self.dummyReceiver_2['id']
        receivers_ids = [self.dummyReceiver_1['id'], self.dummyReceiver_2['id']]

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

        self.dummyContext['steps'].append(self.get_dummy_step())
        self.dummyContext['steps'][2]['context_id'] = self.dummyContext['id']
        self.dummyContext['steps'][2]['label'] = 'Whistleblower identity'
        self.dummyContext['steps'][2]['presentation_order'] = 1
        self.dummyContext['steps'][2] = yield create_step(self.dummyContext['steps'][2], 'en')

        if self.complex_field_population:
            yield self.add_whistleblower_identity_field_to_step(self.dummyContext['steps'][2]['id'])

            self.dummyContext['steps'][1]['presentation_order'] = 2
            yield update_step(self.dummyContext['steps'][1]['id'], self.dummyContext['steps'][1], 'en')

            self.dummyContext['steps'] = [
                self.dummyContext['steps'][0],
                self.dummyContext['steps'][2],
                self.dummyContext['steps'][1]
            ]