def set_up_app(self): self.factory = AppFactory(build_version='2.30.0') training_module = self.factory.app.add_module(Module.new_training_module('training module', None)) self.releases_form = self.factory.app.new_form(training_module.id, "Untitled Form", None) self.releases_form.is_release_notes_form=True self.releases_form.xmlns = "http://openrosa.org/formdesigner/{}".format(uuid.uuid4().hex) basic_module, self.basic_form = self.factory.new_basic_module("basic_module", "doctor", with_form=True) self.basic_form.xmlns = "http://openrosa.org/formdesigner/{}".format(uuid.uuid4().hex)
def test_training_module_as_parent(self, *args): factory = AppFactory(build_version='2.43.0') app = factory.app training_module = Module.new_training_module('training', 'en') app.add_module(training_module) child_module, _ = factory.new_basic_module('child', 'case_type', parent_module=training_module) self.assertIn({ 'type': 'training module parent', 'module': {'id': 1, 'unique_id': 'child_module', 'name': {'en': 'child module'}} }, app.validate_app())
def test_training_module_put_in_root(self, *args): app = Application.new_app('domain', 'Untitled Application') training_module = app.add_module( Module.new_training_module('training module', None)) training_module.put_in_root = True app.new_form(training_module.id, "Untitled Form", None) self.assertXmlPartialEqual( """ <partial> <menu id="training-root"> <text> <locale id="training.root.title"/> </text> <command id="m0-f0"/> </menu> </partial> """, app.create_suite(), "./menu")
def _new_training_module(request, domain, app, name, lang): name = name or 'Training' module = app.add_module(Module.new_training_module(name, lang)) app.save() return back_to_main(request, domain, app_id=app.id, module_id=module.id)