Esempio n. 1
0
    def generate_suite(self):
        # Note: the order in which things happen in this function matters

        self._add_sections([
            FormResourceContributor(self.suite, self.app, self.modules,
                                    self.build_profile_id),
            LocaleResourceContributor(self.suite, self.app, self.modules,
                                      self.build_profile_id),
            DetailContributor(self.suite, self.app, self.modules,
                              self.build_profile_id),
        ])

        if self.app.supports_practice_users and self.app.get_practice_user(
                self.build_profile_id):
            self._add_sections([
                PracticeUserRestoreContributor(self.suite, self.app,
                                               self.modules,
                                               self.build_profile_id)
            ])

        # by module
        entries = EntriesContributor(self.suite, self.app, self.modules,
                                     self.build_profile_id)
        menus = MenuContributor(self.suite, self.app, self.modules,
                                self.build_profile_id)
        remote_requests = RemoteRequestContributor(self.suite, self.app,
                                                   self.modules)

        if any(module.is_training_module for module in self.modules):
            training_menu = LocalizedMenu(id='training-root')
            training_menu.text = Text(
                locale_id=id_strings.training_module_locale())
        else:
            training_menu = None

        for module in self.modules:
            self.suite.entries.extend(entries.get_module_contributions(module))

            self.suite.menus.extend(
                menus.get_module_contributions(module, training_menu))

            self.suite.remote_requests.extend(
                remote_requests.get_module_contributions(module))

        if training_menu:
            self.suite.menus.append(training_menu)

        self._add_sections([
            FixtureContributor(self.suite, self.app, self.modules),
            SchedulerFixtureContributor(self.suite, self.app, self.modules),
        ])

        # post process
        if self.app.enable_post_form_workflow:
            WorkflowHelper(self.suite, self.app, self.modules).update_suite()
        if self.app.use_grid_menus:
            GridMenuHelper(self.suite, self.app, self.modules).update_suite()

        EntryInstances(self.suite, self.app, self.modules).update_suite()
        return self.suite.serializeDocument(pretty=True)
Esempio n. 2
0
    def setUp(self):
        self.factory = AppFactory(domain=DOMAIN)
        self.app_id = uuid4().hex
        self.factory.app._id = self.app_id
        module, form = self.factory.new_basic_module('basic', 'tree')
        self.factory.form_requires_case(form, 'tree')
        child_module, child_form = self.factory.new_basic_module('child', 'leaf', parent_module=module)
        self.factory.form_requires_case(child_form, 'leaf')

        child_module.search_config = CaseSearch(
            search_label=CaseSearchLabel(label={'en': 'Search'}),
            properties=[CaseSearchProperty(name=field) for field in ['name', 'shape']],
            data_registry="a_registry",
            data_registry_workflow=REGISTRY_WORKFLOW_SMART_LINK,
        )
        child_module.assign_references()

        child_module.session_endpoint_id = "child_endpoint"
        child_module.parent_select.active = True
        child_module.parent_select.module_id = module.unique_id

        generator = SuiteGenerator(self.factory.app)
        detail_section_elements = generator.add_section(DetailContributor)
        entries = EntriesContributor(generator.suite, self.factory.app, self.factory.app.modules)
        generator.suite.entries.extend(entries.get_module_contributions(child_module))
        self.request_factory = RemoteRequestFactory(generator.suite, child_module, detail_section_elements)
Esempio n. 3
0
    def generate_suite(self):
        # Note: the order in which things happen in this function matters

        self._add_sections([
            FormResourceContributor(self.suite, self.app, self.modules, self.build_profile_id),
            LocaleResourceContributor(self.suite, self.app, self.modules, self.build_profile_id),
            DetailContributor(self.suite, self.app, self.modules, self.build_profile_id),
        ])

        if self.app.supports_practice_users and self.app.get_practice_user(self.build_profile_id):
            self._add_sections([
                PracticeUserRestoreContributor(self.suite, self.app, self.modules, self.build_profile_id)
            ])

        # by module
        entries = EntriesContributor(self.suite, self.app, self.modules, self.build_profile_id)
        menus = MenuContributor(self.suite, self.app, self.modules, self.build_profile_id)
        remote_requests = RemoteRequestContributor(self.suite, self.app, self.modules)

        if any(module.is_training_module for module in self.modules):
            training_menu = LocalizedMenu(id='training-root')
            training_menu.text = Text(locale_id=id_strings.training_module_locale())
        else:
            training_menu = None

        for module in self.modules:
            self.suite.entries.extend(entries.get_module_contributions(module))

            self.suite.menus.extend(
                menus.get_module_contributions(module, training_menu)
            )

            self.suite.remote_requests.extend(remote_requests.get_module_contributions(module))

        if training_menu:
            self.suite.menus.append(training_menu)

        self._add_sections([
            FixtureContributor(self.suite, self.app, self.modules),
            SchedulerFixtureContributor(self.suite, self.app, self.modules),
        ])

        # post process
        if self.app.enable_post_form_workflow:
            WorkflowHelper(self.suite, self.app, self.modules).update_suite()
        if self.app.use_grid_menus:
            GridMenuHelper(self.suite, self.app, self.modules).update_suite()

        EntryInstances(self.suite, self.app, self.modules).update_suite()
        return self.suite.serializeDocument(pretty=True)
Esempio n. 4
0
    def generate_suite(self):
        # Note: the order in which things happen in this function matters

        self._add_sections([
            FormResourceContributor(self.suite, self.app, self.modules,
                                    self.build_profile_id),
            LocaleResourceContributor(self.suite, self.app, self.modules,
                                      self.build_profile_id),
            DetailContributor(self.suite, self.app, self.modules,
                              self.build_profile_id),
        ])

        # by module
        entries = EntriesContributor(self.suite, self.app, self.modules)
        menus = MenuContributor(self.suite, self.app, self.modules)
        careplan_menus = CareplanMenuContributor(self.suite, self.app,
                                                 self.modules)
        remote_requests = RemoteRequestContributor(self.suite, self.app,
                                                   self.modules)
        for module in self.modules:
            self.suite.entries.extend(entries.get_module_contributions(module))

            self.suite.menus.extend(
                careplan_menus.get_module_contributions(module))
            self.suite.menus.extend(menus.get_module_contributions(module))

            self.suite.remote_requests.extend(
                remote_requests.get_module_contributions(module))

        self._add_sections([
            FixtureContributor(self.suite, self.app, self.modules),
            SchedulerFixtureContributor(self.suite, self.app, self.modules),
        ])

        # post process
        if self.app.enable_post_form_workflow:
            WorkflowHelper(self.suite, self.app, self.modules).update_suite()
        if self.app.grid_menu_toggle_enabled() and self.app.use_grid_menus:
            GridMenuHelper(self.suite, self.app, self.modules).update_suite()

        EntryInstances(self.suite, self.app, self.modules).update_suite()
        return self.suite.serializeDocument(pretty=True)
Esempio n. 5
0
    def generate_suite(self):
        # Note: the order in which things happen in this function matters

        self._add_sections([
            FormResourceContributor(self.suite, self.app, self.modules, self.build_profile_id),
            LocaleResourceContributor(self.suite, self.app, self.modules, self.build_profile_id),
            DetailContributor(self.suite, self.app, self.modules, self.build_profile_id),
        ])

        # by module
        entries = EntriesContributor(self.suite, self.app, self.modules)
        menus = MenuContributor(self.suite, self.app, self.modules)
        careplan_menus = CareplanMenuContributor(self.suite, self.app, self.modules)
        sync_requests = SyncRequestContributor(self.suite, self.app, self.modules)
        for module in self.modules:
            self.suite.entries.extend(entries.get_module_contributions(module))

            self.suite.menus.extend(
                careplan_menus.get_module_contributions(module)
            )
            self.suite.menus.extend(
                menus.get_module_contributions(module)
            )

            self.suite.sync_requests.extend(sync_requests.get_module_contributions(module))

        self._add_sections([
            FixtureContributor(self.suite, self.app, self.modules),
            SchedulerFixtureContributor(self.suite, self.app, self.modules),
        ])

        # post process
        if self.app.enable_post_form_workflow:
            WorkflowHelper(self.suite, self.app, self.modules).update_suite()
        if self.app.use_grid_menus:
            GridMenuHelper(self.suite, self.app, self.modules).update_suite()

        EntryInstances(self.suite, self.app, self.modules).update_suite()
        return self.suite.serializeDocument(pretty=True)