def setUp(self):
        self.app = Application.new_app("domain", "New App", APP_V2)
        self.app.version = 3
        self.module = self.app.add_module(Module.new_module("New Module", lang="en"))
        self.form = self.app.new_form(0, "New Form", lang="en")
        self.module.case_type = "test_case_type"
        self.form.source = self.get_xml("original")
        self.form.actions.open_case = OpenCaseAction(name_path="/data/question1", external_id=None)
        self.form.actions.open_case.condition.type = "always"

        self.careplan_module = new_careplan_module(self.app, None, None, self.module)
    def setUp(self):
        self.app = Application.new_app('domain', 'New App', APP_V2)
        self.app.version = 3
        self.module = self.app.add_module(Module.new_module('New Module', lang='en'))
        self.form = self.app.new_form(0, 'New Form', lang='en')
        self.module.case_type = 'test_case_type'
        self.form.source = self.get_xml('original')
        self.form.actions.open_case = OpenCaseAction(name_path="/data/question1", external_id=None)
        self.form.actions.open_case.condition.type = 'always'

        self.careplan_module = new_careplan_module(self.app, None, None, self.module)
예제 #3
0
    def setUp(self):
        self.app = Application.new_app('domain', 'New App', APP_V2)
        self.app.version = 3
        self.module = self.app.add_module(Module.new_module('New Module', lang='en'))
        self.form = self.app.new_form(0, 'New Form', lang='en')
        self.module.case_type = 'test_case_type'
        self.form.source = self.get_xml('original')
        self.form.actions.open_case = OpenCaseAction(name_path="/data/question1", external_id=None)
        self.form.actions.open_case.condition.type = 'always'

        self.careplan_module = new_careplan_module(self.app, None, None, self.module)
예제 #4
0
    def test_careplan_module(self):
        target_module = self.app.add_module(Module.new_module("Module0", "en"))
        target_module.case_type = 'person'

        module = new_careplan_module(self.app, 'Module1', 'en', target_module)

        self.app.save()
        self._test_status_codes(['view_module'], {
            'domain': self.domain.name,
            'app_id': self.app.id,
            'module_id': module.id,
        })
예제 #5
0
    def test_careplan_module(self):
        target_module = self.app.add_module(Module.new_module("Module0", "en"))
        target_module.case_type = 'person'

        module = new_careplan_module(self.app, 'Module1', 'en', target_module)

        self.app.save()
        self._test_status_codes(
            ['view_module'], {
                'domain': self.domain.name,
                'app_id': self.app.id,
                'module_id': module.id,
            })
예제 #6
0
def _new_careplan_module(request, domain, app, name, lang):
    from corehq.apps.app_manager.util import new_careplan_module
    target_module_index = request.POST.get('target_module_id')
    target_module = app.get_module(target_module_index)
    if not target_module.case_type:
        name = target_module.name[lang]
        messages.error(request, _("Please set the case type for the target module '{name}'.".format(name=name)))
        return back_to_main(request, domain, app_id=app.id)
    module = new_careplan_module(app, name, lang, target_module)
    app.save()
    response = back_to_main(request, domain, app_id=app.id, module_id=module.id)
    response.set_cookie('suppress_build_errors', 'yes')
    messages.info(request, _('Caution: Care Plan modules are a labs feature'))
    return response
예제 #7
0
def _new_careplan_module(request, domain, app, name, lang):
    from corehq.apps.app_manager.util import new_careplan_module
    target_module_index = request.POST.get('target_module_id')
    target_module = app.get_module(target_module_index)
    if not target_module.case_type:
        name = target_module.name[lang]
        messages.error(request, _("Please set the case type for the target module '{name}'.".format(name=name)))
        return back_to_main(request, domain, app_id=app.id)
    module = new_careplan_module(app, name, lang, target_module)
    app.save()
    response = back_to_main(request, domain, app_id=app.id, module_id=module.id)
    response.set_cookie('suppress_build_errors', 'yes')
    messages.info(request, _('Caution: Care Plan modules are a labs feature'))
    return response