Exemple #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')
Exemple #2
0
    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')
Exemple #3
0
    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')