def test(self): form = make_form_from_case_blocks([ElementTree.fromstring(CASE_BLOCK)]) lock_manager = process_xform(form, domain=self.domain) with lock_manager as xforms: with CaseDbCache(domain=self.domain) as case_db: with self.assertRaises(PhoneDateValueError): process_cases_with_casedb(xforms, case_db)
def post_xform(cls, instance_xml, attachments=None, process=None, domain='test-domain'): """ create a new xform and releases the lock this is a testing entry point only and is not to be used in real code """ if not process: def process(xform): xform.domain = domain xform_lock = process_xform(instance_xml, attachments=attachments, process=process, domain=domain) with xform_lock as xforms: for xform in xforms: xform.save() return xforms[0]
def post_xform_to_couch(instance, attachments=None, process=None, domain='test-domain'): """ create a new xform and releases the lock this is a testing entry point only and is not to be used in real code """ assert getattr(settings, 'UNIT_TESTING', False) xform_lock = process_xform(instance, attachments=attachments, process=process, domain=domain) with xform_lock as xforms: for xform in xforms: xform.save() return xforms[0]
def post_xform_to_couch(instance, attachments=None, process=None, domain='test-domain'): """ create a new xform and releases the lock this is a testing entry point only and is not to be used in real code """ assert getattr(settings, 'UNIT_TESTING', False) if not process: def process(xform): xform.domain = domain xform_lock = process_xform(instance, attachments=attachments, process=process, domain=domain) with xform_lock as xforms: for xform in xforms: xform.save() return xforms[0]