diff options
| author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-07-28 12:56:39 +0200 |
|---|---|---|
| committer | John Villalovos <john@sodarock.com> | 2022-07-28 07:41:36 -0700 |
| commit | 263fe3d24836b34dccdcee0221bd417e0b74fb2e (patch) | |
| tree | c6c563d7b65d26dcb85a67c15bf66dfa68e7cb41 | |
| parent | d9126cd802dd3cfe529fa940300113c4ead3054b (diff) | |
| download | gitlab-263fe3d24836b34dccdcee0221bd417e0b74fb2e.tar.gz | |
test(cli): add tests for token scopes
| -rw-r--r-- | tests/functional/cli/test_cli_resource_access_tokens.py | 32 | ||||
| -rw-r--r-- | tests/functional/cli/test_cli_users.py | 14 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/functional/cli/test_cli_resource_access_tokens.py b/tests/functional/cli/test_cli_resource_access_tokens.py index fe1a5e5..85136b3 100644 --- a/tests/functional/cli/test_cli_resource_access_tokens.py +++ b/tests/functional/cli/test_cli_resource_access_tokens.py @@ -8,9 +8,41 @@ def test_list_project_access_tokens(gitlab_cli, project): assert ret.success +def test_create_project_access_token_with_scopes(gitlab_cli, project): + cmd = [ + "project-access-token", + "create", + "--project-id", + project.id, + "--name", + "test-token", + "--scopes", + "api,read_repository", + ] + ret = gitlab_cli(cmd) + + assert ret.success + + @pytest.mark.skip(reason="Requires GitLab 14.7") def test_list_group_access_tokens(gitlab_cli, group): cmd = ["group-access-token", "list", "--group-id", group.id] ret = gitlab_cli(cmd) assert ret.success + + +def test_create_group_access_token_with_scopes(gitlab_cli, group): + cmd = [ + "group-access-token", + "create", + "--group-id", + group.id, + "--name", + "test-token", + "--scopes", + "api,read_repository", + ] + ret = gitlab_cli(cmd) + + assert ret.success diff --git a/tests/functional/cli/test_cli_users.py b/tests/functional/cli/test_cli_users.py new file mode 100644 index 0000000..7402013 --- /dev/null +++ b/tests/functional/cli/test_cli_users.py @@ -0,0 +1,14 @@ +def test_create_user_impersonation_token_with_scopes(gitlab_cli, user): + cmd = [ + "user-impersonation-token", + "create", + "--user-id", + user.id, + "--name", + "test-token", + "--scopes", + "api,read_user", + ] + ret = gitlab_cli(cmd) + + assert ret.success |
