def has_multimedia(self, in_data): """Checks to see if this form export has multimedia available to export """ try: size_hash = get_attachment_size_by_domain_app_id_xmlns(self.domain) export_object = self.get_export_schema(self.domain, self.export_id) hash_key = (export_object.app_id, export_object.xmlns if hasattr(export_object, "xmlns") else "") has_multimedia = hash_key in size_hash except Exception as e: return format_angular_error(e.message) return format_angular_success({"hasMultimedia": has_multimedia})
def test_get_attachment_size_by_domain_app_id_xmlns_xmlns_2(self): atts = get_attachment_size_by_domain_app_id_xmlns(DOMAIN, APP_ID_1, xmlns=XMLNS_2) self.assertEqual(atts, {})
def test_get_attachment_size_by_domain_app_id_xmlns_xmlns_1(self): atts = get_attachment_size_by_domain_app_id_xmlns(DOMAIN, APP_ID_1, xmlns=XMLNS_1) self.assertEqual(len(atts), 1) self.assertIn((APP_ID_1, XMLNS_1), atts)