1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/endpoints/api/test/test_permission.py
Kenny Lee Sin Cheong 72f7c64ed6 chore: update werkzeug and related package versions (PROJQUAY-5098) (#1982)
* chore: update werkzeug and related package versions (PROJQUAY-5098)

Path converter related change reference: https://github.com/pallets/werkzeug/issues/2506

* Update query count
2023-09-12 11:51:09 -04:00

33 lines
1.2 KiB
Python

from test.fixtures import *
import pytest
from endpoints.api.permission import RepositoryUserPermission
from endpoints.api.test.shared import conduct_api_call
from endpoints.test.shared import client_with_identity
@pytest.mark.parametrize(
"repository, username, expected_code",
[
pytest.param("devtable/simple", "public", 200, id="valid user under user"),
pytest.param("devtable/simple", "devtable+dtrobot", 200, id="valid robot under user"),
pytest.param("devtable/simple", "buynlarge+coolrobot", 400, id="invalid robot under user"),
pytest.param("buynlarge/orgrepo", "devtable", 200, id="valid user under org"),
pytest.param("buynlarge/orgrepo", "devtable+dtrobot", 400, id="invalid robot under org"),
pytest.param("buynlarge/orgrepo", "buynlarge+coolrobot", 200, id="valid robot under org"),
],
)
def test_robot_permission(repository, username, expected_code, app):
with client_with_identity("devtable", app) as cl:
conduct_api_call(
cl,
RepositoryUserPermission,
"PUT",
{"repository": repository, "username": username},
body={
"role": "read",
},
expected_code=expected_code,
)