def handle(self, master_id, linked_id, url_base, domain, username, api_key, **options): remote_details = RemoteLinkDetails( url_base, username, api_key, ) linked_app = LinkedApplication.get(linked_id) link_app(linked_app, domain, master_id, remote_details)
def handle(self, master_id, linked_id, **options): print("Linking apps") master_app = Application.get(master_id) master_version = get_latest_released_app_version(master_app.domain, master_id) if not master_version: raise CommandError( "Creating linked app failed." " Unable to get latest released version of your app." " Make sure you have at least one released build." ) linked_app = LinkedApplication.get(linked_id) link_app(linked_app, master_app.domain, master_id) update_linked_app(linked_app, 'system')
def test_linked_app_filter_maps_correctly(self): linked_app = link_app(self.linked_app, self.domain, self.master1.get_id) self.data_source.configured_filter = { "type": "and", "filters": [{ "type": "boolean_expression", "operator": "eq", "expression": { "type": "property_name", "property_name": "xmlns", "datatype": None }, "property_value": "http://openrosa.org/formdesigner/1A255365-DAA1-4815-906D-CBD8D3A462B1", "comment": None }, { "type": "boolean_expression", "operator": "eq", "expression": { "type": "property_name", "property_name": "app_id", "datatype": None }, "property_value": self.master1.get_id, "comment": None }] } self.data_source.save() linked_report_info = create_linked_ucr(self.domain_link, self.report.get_id) self.assertEqual( linked_report_info.datasource.configured_filter['filters'][1] ['property_value'], linked_app.get_id)
def testConvertToApplication(self): factory = AppFactory(build_version='2.40.0') factory.new_basic_module('register', 'case', with_form=False) factory.app.save() build = factory.app.make_build() build.is_released = True build.save() linked_app = LinkedApplication() linked_app.domain = 'other-domain' linked_app.save() link_app(linked_app, factory.app.domain, factory.app.id) update_linked_app(linked_app, factory.app.id, 'system') unlinked_doc = linked_app.convert_to_application().to_json() self.assertEqual(unlinked_doc['doc_type'], 'Application') self.assertFalse(hasattr(unlinked_doc, 'linked_app_attrs')) linked_app.delete()
def testConvertToApplication(self): factory = AppFactory(build_version='2.40.0') m0, f0 = factory.new_basic_module('register', 'case') f0.source = get_simple_form(xmlns=f0.unique_id) factory.app.save() self.addCleanup(factory.app.delete) build = factory.app.make_build() build.is_released = True build.save() self.addCleanup(build.delete) linked_app = LinkedApplication() linked_app.domain = 'other-domain' linked_app.save() self.addCleanup(linked_app.delete) link_app(linked_app, factory.app.domain, factory.app.id) update_linked_app(linked_app, factory.app.id, 'system') unlinked_doc = linked_app.convert_to_application().to_json() self.assertEqual(unlinked_doc['doc_type'], 'Application') self.assertFalse(hasattr(unlinked_doc, 'linked_app_attrs'))