# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test62
# FileName:      test_bpm_3_org.py
# Author:       lao_zhao
# Datetime:     2024/9/3 9:45
# Description:
# 
# ---------------------------------------------------------------------------
import allure
import pytest

import test_example


class TestBPMOrg:

    @allure.epic("BPM系统-场景测试")
    @allure.feature("组织管理")
    @allure.story("添加组织")
    @allure.title("添加组织-正向用例")
    @allure.severity("高")
    @pytest.mark.dependency(depends=["test_case/test_dependency/test_bpm_1_login.py::TestBPMLogin::test_login", "test_case/test_dependency/test_bpm_2_dem.py::TestBPMDem::test_add_dem"], scope="package")
    def test_add_org(self, fix_req, fix_dependency, fix_db):
        add_org_url = test_example.host + "/api/org/v1/org/addOrg"
        add_org_data = {
                "code": "testAddOrg",
                "demId": fix_dependency["demId"],
                "exceedLimitNum": 0,
                "grade": "",
                "limitNum": 0,
                "name": "测试添加的组织",
                "nowNum": 0,
                "orderNo": 0,
                "parentId": "0"
            }
        fix_db.delete("""delete from uc_org where CODE_="testAddOrg";""")
        res = fix_req.request(method="post", url=add_org_url, json=add_org_data)
        try:
            assert "成功" in res.text
        except AssertionError:
            print("断言失败")
            raise AssertionError("断言失败")