Replaces LICENSE (GPLv3 -> AGPLv3) and prepends `SPDX-License-Identifier: AGPL-3.0-or-later` to every source file across decnet/, decnet_web/, tests/, scripts/, and tools/. Rationale: closes the GPLv3 ASP loophole so any party operating a modified DECNET as a network service must offer their modified source. Personal copyright (Samuel Paschuan) + inbound=outbound contributions make a future unilateral relicense infeasible. - LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt) - COPYRIGHT: project copyright notice - tools/add_spdx_headers.py: idempotent header injector (shebang- and PEP 263-aware) Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh). No behavior change; comments only.
79 lines
2.5 KiB
Python
79 lines
2.5 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_update_deployment_limit_admin(client, auth_token):
|
|
resp = await client.put(
|
|
"/api/v1/config/deployment-limit",
|
|
json={"deployment_limit": 50},
|
|
headers={"Authorization": f"Bearer {auth_token}"},
|
|
)
|
|
assert resp.status_code == 200
|
|
assert resp.json()["message"] == "Deployment limit updated"
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_update_deployment_limit_out_of_range(client, auth_token):
|
|
resp = await client.put(
|
|
"/api/v1/config/deployment-limit",
|
|
json={"deployment_limit": 0},
|
|
headers={"Authorization": f"Bearer {auth_token}"},
|
|
)
|
|
assert resp.status_code == 422
|
|
|
|
resp = await client.put(
|
|
"/api/v1/config/deployment-limit",
|
|
json={"deployment_limit": 501},
|
|
headers={"Authorization": f"Bearer {auth_token}"},
|
|
)
|
|
assert resp.status_code == 422
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_update_deployment_limit_viewer_forbidden(client, auth_token, viewer_token):
|
|
resp = await client.put(
|
|
"/api/v1/config/deployment-limit",
|
|
json={"deployment_limit": 50},
|
|
headers={"Authorization": f"Bearer {viewer_token}"},
|
|
)
|
|
assert resp.status_code == 403
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_update_global_mutation_interval_admin(client, auth_token):
|
|
resp = await client.put(
|
|
"/api/v1/config/global-mutation-interval",
|
|
json={"global_mutation_interval": "7d"},
|
|
headers={"Authorization": f"Bearer {auth_token}"},
|
|
)
|
|
assert resp.status_code == 200
|
|
assert resp.json()["message"] == "Global mutation interval updated"
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_update_global_mutation_interval_invalid(client, auth_token):
|
|
resp = await client.put(
|
|
"/api/v1/config/global-mutation-interval",
|
|
json={"global_mutation_interval": "abc"},
|
|
headers={"Authorization": f"Bearer {auth_token}"},
|
|
)
|
|
assert resp.status_code == 422
|
|
|
|
resp = await client.put(
|
|
"/api/v1/config/global-mutation-interval",
|
|
json={"global_mutation_interval": "0m"},
|
|
headers={"Authorization": f"Bearer {auth_token}"},
|
|
)
|
|
assert resp.status_code == 422
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_update_global_mutation_interval_viewer_forbidden(client, auth_token, viewer_token):
|
|
resp = await client.put(
|
|
"/api/v1/config/global-mutation-interval",
|
|
json={"global_mutation_interval": "7d"},
|
|
headers={"Authorization": f"Bearer {viewer_token}"},
|
|
)
|
|
assert resp.status_code == 403
|