|
|
@@ -357,6 +357,47 @@ class TestConditionPublish(unittest.TestCase):
|
|
|
)
|
|
|
self.assertTrue(any("发起人" in e and "包含" in e for e in errs))
|
|
|
|
|
|
+ def test_dept_condition_field_allowed(self):
|
|
|
+ errs = validate_condition_rules_against_form(
|
|
|
+ {
|
|
|
+ "rule": [
|
|
|
+ {
|
|
|
+ "type": "dept",
|
|
|
+ "field": "Fdept",
|
|
|
+ "title": "部门",
|
|
|
+ "useInCondition": True,
|
|
|
+ "$required": True,
|
|
|
+ "props": {"multiple": True},
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ _condition_flow(
|
|
|
+ rules=[
|
|
|
+ {"field": "Fdept", "op": "contains", "value": ["d1", "d2"]}
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ self.assertEqual(errs, [])
|
|
|
+
|
|
|
+ def test_owner_dept_condition_field_allowed(self):
|
|
|
+ errs = validate_condition_rules_against_form(
|
|
|
+ {
|
|
|
+ "rule": [
|
|
|
+ {
|
|
|
+ "type": "ownerDept",
|
|
|
+ "field": "Fod",
|
|
|
+ "title": "归属部门",
|
|
|
+ "useInCondition": True,
|
|
|
+ "$required": True,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ _condition_flow(
|
|
|
+ rules=[{"field": "Fod", "op": "contains", "value": ["d1"]}]
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ self.assertEqual(errs, [])
|
|
|
+
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
unittest.main()
|