# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test67
# FileName:      test_org.py
# Author:       lao_zhao
# Datetime:     2025/6/12 10:17
# Description:
# 
# ---------------------------------------------------------------------------
import random
import string

import allure
import pytest
from faker import Faker


# 跨模块用例之间的数据依赖
class TestOrg:

    @classmethod
    def setup_class(cls):
        cls.data = Faker(locale="zh_cn")

    @allure.epic("BPM-添加组织的场景测试")
    @allure.feature("组织管理")
    @allure.story("添加组织")
    @allure.title("添加组织依赖维度的id信息")
    @pytest.mark.dependency(depends=["test_case/test_bpm/test_dem.py::test_get_dem_message"], scope="session")
    def test_add_org(self, dependency_data_fix, session_fix):
        """测试添加组织"""
        # 维度
        add_org_url = "http://36.139.193.99:8088/api/org/v1/org/addOrg"
        add_org_data = {
                "code": f'test_{"".join(random.sample(string.ascii_letters, 12))}',
                "demId": dependency_data_fix["demId"],
                "exceedLimitNum": 0,
                "grade": "",
                "limitNum": 0,
                "name": f"{self.data.company()}",
                "nowNum": 0,
                "orderNo": 0,
                "parentId": "0"
            }
        res = session_fix.post(url=add_org_url, json=add_org_data)
        print(res.text)
