From e8e2425eb477a74aa39dd8138f943d5da60afe7f Mon Sep 17 00:00:00 2001 From: dcd <1151627903@qq.com> Date: Tue, 24 Dec 2024 15:24:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9B=E5=BB=BA=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BC=80=E5=90=AF=E8=AE=A2=E9=98=85=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=20(closed=20#2525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/backend/subscription/serializers.py | 1 + apps/backend/tests/subscription/test_views.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/backend/subscription/serializers.py b/apps/backend/subscription/serializers.py index 053db9f87..da285bae4 100644 --- a/apps/backend/subscription/serializers.py +++ b/apps/backend/subscription/serializers.py @@ -87,6 +87,7 @@ class CreateStepSerializer(serializers.Serializer): steps = serializers.ListField(child=CreateStepSerializer(), min_length=1, label="事件订阅触发的动作列表") target_hosts = TargetHostSerializer(many=True, label="下发的目标机器列表", required=False, allow_empty=False) run_immediately = serializers.BooleanField(required=False, default=False, label="是否立即执行") + enable = serializers.BooleanField(required=False, default=False, label="是否开启订阅巡检") is_main = serializers.BooleanField(required=False, default=False, label="是否为主配置") operate_info = serializers.ListField(required=False, child=HostOperateInfoSerializer(), default=[], label="操作信息") system_account = serializers.DictField(required=False, label=_("操作系统对应账户")) diff --git a/apps/backend/tests/subscription/test_views.py b/apps/backend/tests/subscription/test_views.py index 2df30b86c..355100576 100644 --- a/apps/backend/tests/subscription/test_views.py +++ b/apps/backend/tests/subscription/test_views.py @@ -95,6 +95,7 @@ def _test_create_subscription(self): { "bk_username": "admin", "bk_app_code": "blueking", + "enable": True, "scope": { "bk_biz_id": self.TEST_BIZ_ID, "node_type": "TOPO", @@ -125,7 +126,8 @@ def _test_create_subscription(self): subscription_id = r.data["data"]["subscription_id"] # 探测数据库是否创建了对应的记录 - Subscription.objects.get(id=r.data["data"]["subscription_id"]) + subscription_obj = Subscription.objects.get(id=r.data["data"]["subscription_id"]) + self.assertEqual(subscription_obj.enable, True) SubscriptionStep.objects.get(step_id="my_first", subscription_id=subscription_id) return subscription_id