コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
ファイル: processor.py プロジェクト: nnestle/commcare-hq
    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]
コード例 #4
0
ファイル: testutils.py プロジェクト: LifeCoaching/commcare-hq
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]
コード例 #5
0
ファイル: testutils.py プロジェクト: ekush/commcare-hq
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]