

def test_get_rules_from_domain(self):
    rules = AutomaticUpdateRule.by_domain(self.domain)
    rules_by_case_type = AutomaticUpdateRule.organize_rules_by_case_type(rules)
    expected_case_types = ['test-case-type', 'test-case-type-2']
    actual_case_types = rules_by_case_type.keys()
    rules_by_case_type.assertEqual(set(expected_case_types), set(actual_case_types))
    expected_rule_ids = [self.rule.pk]
    actual_rule_ids = [rule.pk for rule in rules_by_case_type['test-case-type']]
    self.assertEqual(set(expected_rule_ids), set(actual_rule_ids))
    expected_rule_ids = [self.rule2.pk, self.rule3.pk]
    actual_rule_ids = [rule.pk for rule in rules_by_case_type['test-case-type-2']]
    self.assertEqual(set(expected_rule_ids), set(actual_rule_ids))

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/data_interfaces/tests/test_auto_case_updates.py AutomaticCaseUpdateTest.test_get_rules_from_domain/VarMisuse@46/97 `self`->`rules_by_case_type`