From 21e037309a13bd19df7f70da35340a781c0d67fb Mon Sep 17 00:00:00 2001 From: schnee Date: Wed, 6 Sep 2023 17:42:06 +0800 Subject: [PATCH] test: fix unittest --- .../apis/web/data_source/test_data_source.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bk-user/tests/apis/web/data_source/test_data_source.py b/src/bk-user/tests/apis/web/data_source/test_data_source.py index a835fbb77..8cce58e12 100644 --- a/src/bk-user/tests/apis/web/data_source/test_data_source.py +++ b/src/bk-user/tests/apis/web/data_source/test_data_source.py @@ -30,7 +30,7 @@ @pytest.fixture() def local_ds_plugin_config() -> Dict[str, Any]: return { - "enable_login_by_password": True, + "enable_account_password_login": True, "password_rule": { "min_length": 12, "contain_lowercase": True, @@ -172,7 +172,7 @@ def test_create_with_minimal_plugin_config(self, api_client): data={ "name": generate_random_string(), "plugin_id": DataSourcePluginEnum.LOCAL, - "plugin_config": {"enable_login_by_password": False}, + "plugin_config": {"enable_account_password_login": False}, }, ) assert resp.status_code == status.HTTP_201_CREATED @@ -224,7 +224,7 @@ def test_create_with_invalid_notification_template(self, api_client, local_ds_pl assert "邮件通知模板需要提供标题" in resp.data["message"] def test_create_with_invalid_plugin_config(self, api_client, local_ds_plugin_config): - local_ds_plugin_config.pop("enable_login_by_password") + local_ds_plugin_config.pop("enable_account_password_login") resp = api_client.post( reverse("data_source.list_create"), data={ @@ -234,7 +234,7 @@ def test_create_with_invalid_plugin_config(self, api_client, local_ds_plugin_con }, ) assert resp.status_code == status.HTTP_400_BAD_REQUEST - assert "插件配置不合法:enable_login_by_password: Field required" in resp.data["message"] + assert "插件配置不合法:enable_account_password_login: Field required" in resp.data["message"] def test_create_without_required_field_mapping(self, api_client): """非本地数据源,需要字段映射配置""" @@ -266,7 +266,7 @@ def test_list_other_tenant_data_source(self, api_client, random_tenant, data_sou class TestDataSourceUpdateApi: def test_update_local_data_source(self, api_client, data_source, local_ds_plugin_config): - local_ds_plugin_config["enable_login_by_password"] = False + local_ds_plugin_config["enable_account_password_login"] = False resp = api_client.put( reverse("data_source.retrieve_update", kwargs={"id": data_source.id}), data={"plugin_config": local_ds_plugin_config}, @@ -274,16 +274,16 @@ def test_update_local_data_source(self, api_client, data_source, local_ds_plugin assert resp.status_code == status.HTTP_204_NO_CONTENT resp = api_client.get(reverse("data_source.retrieve_update", kwargs={"id": data_source.id})) - assert resp.data["plugin_config"]["enable_login_by_password"] is False + assert resp.data["plugin_config"]["enable_account_password_login"] is False def test_update_with_invalid_plugin_config(self, api_client, data_source, local_ds_plugin_config): - local_ds_plugin_config.pop("enable_login_by_password") + local_ds_plugin_config.pop("enable_account_password_login") resp = api_client.put( reverse("data_source.retrieve_update", kwargs={"id": data_source.id}), data={"plugin_config": local_ds_plugin_config}, ) assert resp.status_code == status.HTTP_400_BAD_REQUEST - assert "插件配置不合法:enable_login_by_password: Field required" in resp.data["message"] + assert "插件配置不合法:enable_account_password_login: Field required" in resp.data["message"] def test_update_without_required_field_mapping(self, api_client): """非本地数据源,需要字段映射配置"""