24 lines
1.2 KiB
Python
24 lines
1.2 KiB
Python
|
|
"""来源单价人工确认的双权限校验。"""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
from tests.integration.test_authorization import role, save
|
||
|
|
from tests.integration.test_tplus_workbench import workspace as workspace
|
||
|
|
|
||
|
|
pytestmark = pytest.mark.integration
|
||
|
|
|
||
|
|
|
||
|
|
def test_确认来源单价需要业务更新和核算准备双权限(client, admin, normal, workspace):
|
||
|
|
business_only = role(client, admin, ["business:businesses:view", "business:businesses:update"])
|
||
|
|
payroll_only = role(client, admin, ["payroll:view", "payroll:prepare"])
|
||
|
|
url = "/api/v1/business/businesses/1/source-documents/1/missing-price"
|
||
|
|
payload = {"revision": "0" * 64, "evidence": "权限回归"}
|
||
|
|
for item in (business_only, payroll_only):
|
||
|
|
assert save(client, admin, normal["id"], role_codes=["user", item["role_code"]]).status_code == 200
|
||
|
|
assert client.put(url, headers=normal["headers"], json=payload).status_code == 403
|
||
|
|
assert save(client, admin, normal["id"], role_codes=[
|
||
|
|
"user", business_only["role_code"], payroll_only["role_code"]]).status_code == 200
|
||
|
|
response = client.put(url, headers=normal["headers"], json=payload)
|
||
|
|
assert response.status_code == 400
|
||
|
|
assert "来源业务" in response.json()["message"]
|