# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test66
# FileName:      test_org.py
# Author:       lao_zhao
# Datetime:     2025/5/8 10:21
# Description:
# 
# ---------------------------------------------------------------------------
import pytest
from faker import Faker

data = Faker(locale="zh_cn")

'''
# 添加组织
@pytest.mark.dependency(depends=['test_bpm/test_auth.py::TestAuth::test_login', 'test_bpm/test_dem.py::test_add_dem'], scope="session")
def test_add_org(req_fix, depend_data_fix):
    print(depend_data_fix["DEMID"])
    add_org_url = 'http://36.139.193.99:8088/api/org/v1/org/addOrg'
    add_org_data = {
        "code": data.phone_number(),
        "demId": depend_data_fix["DEMID"],
        "exceedLimitNum": 0,
        "grade": "",
        "limitNum": 0,
        "name": data.company(),
        "nowNum": 0,
        "orderNo": 0,
        "parentId": "0"
    }
    res = req_fix.bpm_session.request(method="post", url=add_org_url, json=add_org_data)
    print(res.text)
    assert "成功" in res.text
'''


# 添加组织
@pytest.mark.dependency(depends=['test_bpm_dependency/test_auth.py::TestAuth::test_login', 'test_bpm_dependency/test_dem.py::test_add_dem'], scope="session")
def test_add_org(req_fix, get_depend_data_fix):
    print(get_depend_data_fix("DEMID"))
    add_org_url = 'http://36.139.193.99:8088/api/org/v1/org/addOrg'
    add_org_data = {
        "code": data.phone_number(),
        "demId": get_depend_data_fix("DEMID"),
        "exceedLimitNum": 0,
        "grade": "",
        "limitNum": 0,
        "name": data.company(),
        "nowNum": 0,
        "orderNo": 0,
        "parentId": "0"
    }
    res = req_fix.bpm_session.request(method="post", url=add_org_url, json=add_org_data)
    print(res.text)
    assert "成功" in res.text