Skip to content

Commit 263fe3d

Browse files
nejchJohnVillalovos
authored andcommitted
test(cli): add tests for token scopes
1 parent d9126cd commit 263fe3d

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

tests/functional/cli/test_cli_resource_access_tokens.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,41 @@ def test_list_project_access_tokens(gitlab_cli, project):
88
assert ret.success
99

1010

11+
def test_create_project_access_token_with_scopes(gitlab_cli, project):
12+
cmd = [
13+
"project-access-token",
14+
"create",
15+
"--project-id",
16+
project.id,
17+
"--name",
18+
"test-token",
19+
"--scopes",
20+
"api,read_repository",
21+
]
22+
ret = gitlab_cli(cmd)
23+
24+
assert ret.success
25+
26+
1127
@pytest.mark.skip(reason="Requires GitLab 14.7")
1228
def test_list_group_access_tokens(gitlab_cli, group):
1329
cmd = ["group-access-token", "list", "--group-id", group.id]
1430
ret = gitlab_cli(cmd)
1531

1632
assert ret.success
33+
34+
35+
def test_create_group_access_token_with_scopes(gitlab_cli, group):
36+
cmd = [
37+
"group-access-token",
38+
"create",
39+
"--group-id",
40+
group.id,
41+
"--name",
42+
"test-token",
43+
"--scopes",
44+
"api,read_repository",
45+
]
46+
ret = gitlab_cli(cmd)
47+
48+
assert ret.success
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def test_create_user_impersonation_token_with_scopes(gitlab_cli, user):
2+
cmd = [
3+
"user-impersonation-token",
4+
"create",
5+
"--user-id",
6+
user.id,
7+
"--name",
8+
"test-token",
9+
"--scopes",
10+
"api,read_user",
11+
]
12+
ret = gitlab_cli(cmd)
13+
14+
assert ret.success

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy