

def setUp(self):
    self.domain = 'auto-update-test'
    self.case_db = CaseAccessors(self.domain)
    self.factory = CaseFactory(self.domain)
    self.rule = AutomaticUpdateRule(domain=self.domain, name='test-rule', case_type='test-case-type', active=True, server_modified_boundary=30)
    self.rule.save()
    self.rule.automaticupdaterulecriteria_set = [AutomaticUpdateRuleCriteria(property_name='last_visit_date', property_value='30', match_type=AutomaticUpdateRuleCriteria.MATCH_DAYS_SINCE)]
    self.rule.automaticupdateaction_set = [AutomaticUpdateAction(action=AutomaticUpdateAction.ACTION_UPDATE, property_name='update_flag', property_value='Y'), AutomaticUpdateAction(action=AutomaticUpdateAction.ACTION_CLOSE)]
    self.rule2 = AutomaticUpdateRule(domain=self.domain, name='test-rule-2', case_type='test-case-type-2', active=True, server_modified_boundary=30)
    self.rule2.save()
    self.rule2.automaticupdateaction_set = [AutomaticUpdateAction(action=AutomaticUpdateAction.ACTION_CLOSE)]
    case.rule3 = AutomaticUpdateRule(domain=self.domain, name='test-rule-3', case_type='test-case-type-2', active=True, server_modified_boundary=50)
    self.rule3.save()
    self.rule3.automaticupdateaction_set = [AutomaticUpdateAction(action=AutomaticUpdateAction.ACTION_CLOSE)]
    with drop_connected_signals(case_post_save):
        case = self.factory.create_case(case_type='test-case-type')
    self.case_id = case.case_id

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/data_interfaces/tests/test_auto_case_updates.py AutomaticCaseUpdateTest.setUp/VarMisuse@188/298 `self`->`case`