Skip to content

Commit

Permalink
feat: update dependencies for project
Browse files Browse the repository at this point in the history
  • Loading branch information
rolin999 committed Nov 19, 2024
1 parent c03bd1f commit 06f91bd
Show file tree
Hide file tree
Showing 39 changed files with 117 additions and 123 deletions.
66 changes: 30 additions & 36 deletions src/bk-user/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/bk-user/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ldap3 = "2.9.1"

[tool.poetry.group.dev.dependencies]
ruff = "^0.7.1"
mypy = "^1.10.1"
mypy = "1.10.1"
types-requests = "^2.31.0.1"
pytest = "^8.3.3"
pytest-django = "^4.9.0"
Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ kombu==5.4.2 ; python_version >= "3.11" and python_version < "3.12"
ldap3==2.9.1 ; python_version >= "3.11" and python_version < "3.12"
markupsafe==3.0.2 ; python_version >= "3.11" and python_version < "3.12"
mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "3.12"
mypy==1.13.0 ; python_version >= "3.11" and python_version < "3.12"
mypy==1.10.1 ; python_version >= "3.11" and python_version < "3.12"
openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "3.12"
opentelemetry-api==1.24.0 ; python_version >= "3.11" and python_version < "3.12"
opentelemetry-exporter-otlp-proto-common==1.24.0 ; python_version >= "3.11" and python_version < "3.12"
Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/tests/apis/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from rest_framework.test import APIClient


@pytest.fixture()
@pytest.fixture
def api_client(bk_user) -> APIClient:
"""Return an authenticated client"""
client = APIClient()
Expand Down
4 changes: 2 additions & 2 deletions src/bk-user/tests/apis/open_v1/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from tests.test_utils.tenant import sync_users_depts_to_tenant


@pytest.fixture()
@pytest.fixture
def open_v1_api_client() -> APIClient:
client = APIClient()

Expand All @@ -43,7 +43,7 @@ def open_v1_api_client() -> APIClient:
yield client


@pytest.fixture()
@pytest.fixture
def local_data_source(default_tenant, local_ds_plugin_cfg, local_ds_plugin) -> DataSource:
"""默认租户的本地数据源"""
data_source = DataSource.objects.create(
Expand Down
4 changes: 2 additions & 2 deletions src/bk-user/tests/apis/open_v2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
pytestmark = pytest.mark.django_db


@pytest.fixture()
@pytest.fixture
def local_data_source(default_tenant, local_ds_plugin_cfg, local_ds_plugin) -> DataSource:
"""默认租户的本地数据源"""
data_source = DataSource.objects.create(
Expand All @@ -43,7 +43,7 @@ def local_data_source(default_tenant, local_ds_plugin_cfg, local_ds_plugin) -> D
return data_source


@pytest.fixture()
@pytest.fixture
def collaboration_data_source(default_tenant, random_tenant, general_ds_plugin_cfg, general_ds_plugin) -> DataSource:
"""向默认租户进行同步的通用 HTTP 数据源"""
data_source = DataSource.objects.create(
Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/tests/apis/open_v2/test_departments.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_with_invalid_dept_id(self, api_client):


class TestListProfileDepartments:
@pytest.fixture()
@pytest.fixture
def user_lushi(self, default_tenant, local_data_source) -> TenantUser:
return TenantUser.objects.get(
tenant=default_tenant,
Expand Down
14 changes: 7 additions & 7 deletions src/bk-user/tests/apis/web/collaboration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
from tests.test_utils.tenant import create_tenant


@pytest.fixture()
@pytest.fixture
def collaboration_tenant() -> Tenant:
"""创建随机的协同租户"""
return create_tenant(generate_random_string())


@pytest.fixture()
@pytest.fixture
def strategy_source_config() -> Dict:
return {
"organization_scope_type": CollaborationScopeType.ALL,
Expand All @@ -39,7 +39,7 @@ def strategy_source_config() -> Dict:
}


@pytest.fixture()
@pytest.fixture
def strategy_target_config(random_tenant, collaboration_tenant) -> Dict:
return {
"organization_scope_type": CollaborationScopeType.ALL,
Expand Down Expand Up @@ -67,15 +67,15 @@ def _create_strategy(
)


@pytest.fixture()
@pytest.fixture
def collaborate_to_strategy(
random_tenant, collaboration_tenant, strategy_source_config, strategy_target_config
) -> CollaborationStrategy:
"""创建协同策略(本租户分享出去的)"""
return _create_strategy(random_tenant, collaboration_tenant, strategy_source_config, strategy_target_config)


@pytest.fixture()
@pytest.fixture
def collaborate_from_strategy(
random_tenant, collaboration_tenant, strategy_source_config, strategy_target_config
) -> CollaborationStrategy:
Expand Down Expand Up @@ -120,11 +120,11 @@ def _create_tenant_custom_fields(tenant: Tenant) -> None:
)


@pytest.fixture()
@pytest.fixture
def _init_random_tenant_custom_fields(random_tenant):
_create_tenant_custom_fields(random_tenant)


@pytest.fixture()
@pytest.fixture
def _init_collaboration_tenant_custom_fields(collaboration_tenant):
_create_tenant_custom_fields(collaboration_tenant)
14 changes: 7 additions & 7 deletions src/bk-user/tests/apis/web/data_source/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
pytestmark = pytest.mark.django_db


@pytest.fixture()
@pytest.fixture
def data_source(random_tenant, local_ds_plugin_cfg) -> DataSource:
# FIXME (su) 使用 data_source 这个 fixture 其实可以不用 random_tenant,因为使用了 get_or_create
# 在移除默认租户的初始化 migration 中创建的 real 类型的数据源后,可以批量删除 random_tenant 逻辑
Expand All @@ -49,7 +49,7 @@ def data_source(random_tenant, local_ds_plugin_cfg) -> DataSource:
return ds


@pytest.fixture()
@pytest.fixture
def local_idp(data_source) -> Idp:
return Idp.objects.create(
name="local",
Expand All @@ -60,7 +60,7 @@ def local_idp(data_source) -> Idp:
)


@pytest.fixture()
@pytest.fixture
def disabled_idp(data_source) -> Idp:
return Idp.objects.create(
name="invalid_wecom",
Expand All @@ -74,7 +74,7 @@ def disabled_idp(data_source) -> Idp:
)


@pytest.fixture()
@pytest.fixture
def wecom_idp(data_source) -> Idp:
return Idp.objects.create(
name="wecom",
Expand All @@ -87,7 +87,7 @@ def wecom_idp(data_source) -> Idp:
)


@pytest.fixture()
@pytest.fixture
def field_mapping(request) -> List[Dict]:
"""字段映射,不含自定义字段"""
fields = ["username", "full_name", "phone_country_code", "phone", "email"]
Expand All @@ -97,13 +97,13 @@ def field_mapping(request) -> List[Dict]:
return [{"source_field": f, "mapping_operation": "direct", "target_field": f} for f in fields]


@pytest.fixture()
@pytest.fixture
def sync_config() -> Dict[str, Any]:
"""数据源同步配置"""
return {"sync_period": 30}


@pytest.fixture()
@pytest.fixture
def data_source_sync_tasks(data_source) -> List[DataSourceSyncTask]:
success_task = DataSourceSyncTask.objects.create(
data_source=data_source,
Expand Down
6 changes: 3 additions & 3 deletions src/bk-user/tests/apis/web/idp/test_idp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
pytestmark = pytest.mark.django_db


@pytest.fixture()
@pytest.fixture
def wecom_plugin_cfg() -> Dict[str, Any]:
"""企业微信插件配置"""
return {
Expand All @@ -41,7 +41,7 @@ def wecom_plugin_cfg() -> Dict[str, Any]:
}


@pytest.fixture()
@pytest.fixture
def data_source_match_rules(bare_general_data_source) -> List[Dict[str, Any]]:
"""匹配数据源规则"""
return [
Expand All @@ -53,7 +53,7 @@ def data_source_match_rules(bare_general_data_source) -> List[Dict[str, Any]]:
]


@pytest.fixture()
@pytest.fixture
def wecom_idp(bk_user, random_tenant, wecom_plugin_cfg, data_source_match_rules) -> Idp:
return Idp.objects.create(
name=generate_random_string(),
Expand Down
10 changes: 5 additions & 5 deletions src/bk-user/tests/apis/web/organization/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,31 @@ def _create_tenant_custom_fields(tenant: Tenant) -> List[TenantUserCustomField]:
return [age_field, gender_field, region_field, hobbies_field]


@pytest.fixture()
@pytest.fixture
def random_tenant_custom_fields(random_tenant) -> List[TenantUserCustomField]:
"""随机租户的自定义字段"""
return _create_tenant_custom_fields(random_tenant)


@pytest.fixture()
@pytest.fixture
def collaboration_tenant_custom_fields(collaboration_tenant) -> List[TenantUserCustomField]:
"""协同租户的自定义字段"""
return _create_tenant_custom_fields(collaboration_tenant)


@pytest.fixture()
@pytest.fixture
def _init_tenant_users_depts(random_tenant, full_local_data_source, random_tenant_custom_fields) -> None:
"""初始化租户部门 & 租户用户"""
sync_users_depts_to_tenant(random_tenant, full_local_data_source)


@pytest.fixture()
@pytest.fixture
def collaboration_tenant() -> Tenant:
"""创建随机的协同租户"""
return create_tenant(generate_random_string())


@pytest.fixture()
@pytest.fixture
def _init_collaboration_users_depts(
random_tenant,
collaboration_tenant,
Expand Down
4 changes: 2 additions & 2 deletions src/bk-user/tests/apis/web/organization/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_collaboration_tenant(self, api_client, random_tenant, collaboration_ten


class TestTenantUserCreateApi:
@pytest.fixture()
@pytest.fixture
def tenant_user_data(self, random_tenant) -> Dict[str, Any]:
username = generate_random_string()
return {
Expand Down Expand Up @@ -591,7 +591,7 @@ def test_standard(self, api_client, random_tenant):
class TestTenantUserBatchCreateAndPreviewApi:
"""测试快速录入(批量创建)用户 * 预览 API"""

@pytest.fixture()
@pytest.fixture
def raw_user_infos(self) -> List[str]:
# username full_name email phone age gender region hobbies
return [
Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/tests/apis/web/password/test_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
pytestmark = pytest.mark.django_db


@pytest.fixture()
@pytest.fixture
def tenant_user(random_tenant, full_local_data_source) -> TenantUser:
init_local_data_source_identity_infos(full_local_data_source)
sync_users_depts_to_tenant(random_tenant, full_local_data_source)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
pytestmark = pytest.mark.django_db


@pytest.fixture()
@pytest.fixture
def tenant_user(bk_user) -> TenantUser:
return TenantUser.objects.get(tenant_id=bk_user.get_property("tenant_id"), id=bk_user.username)

Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/tests/apis/web/tenant_setting/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
pytestmark = pytest.mark.django_db


@pytest.fixture()
@pytest.fixture
def custom_fields(default_tenant):
custom_field_data = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/tests/apps/data_source/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
FAKE_PASSWORD = "Pa-@-114514-2887"


@pytest.fixture()
@pytest.fixture
def local_ds_with_sensitive(bare_local_data_source) -> DataSource:
"""包含敏感信息的本地数据源"""
plugin_config = bare_local_data_source.plugin_config
Expand Down
Loading

0 comments on commit 06f91bd

Please sign in to comment.