- Notifications
You must be signed in to change notification settings - Fork673
fix: make scopes work with multiple scope-names#1360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
912f622
426b9b5
02012ef
85757d8
f14f91b
9350067
d1de30b
7443cd8
fe6aef3
9c49cc8
0d1dca5
3826ea8
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -561,11 +561,10 @@ def test_create_project_with_values_from_file(gitlab_cli, tmpdir): | ||||||||||||||||||||||||||||||
assert description in ret.stdout | ||||||||||||||||||||||||||||||
defdo_test_create_project_deploy_token(gitlab_cli, project, scopes, expected_scopes): | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. hint: you could keep a single test function here and parametrize the input/expected output with pytest: @pytest.mark.parametrize("scopes,expected_scopes", [ ("read_registry","['read_registry']"), ("read_registry,read_repository","['read_repository', 'read_registry']"), ],)deftest_create_project_deploy_token(gitlab_cli,project,scopes,expected_scopes): ... Then you don't need a custom helper function at all and it will be easy to add more edge cases later. See very similar example here: python-gitlab/gitlab/tests/test_config.py Lines 236 to 249 inaf781c1
| ||||||||||||||||||||||||||||||
name = "project-token" | ||||||||||||||||||||||||||||||
username = "root" | ||||||||||||||||||||||||||||||
expires_at = "2021-09-09" | ||||||||||||||||||||||||||||||
cmd = [ | ||||||||||||||||||||||||||||||
"-v", | ||||||||||||||||||||||||||||||
@@ -588,7 +587,19 @@ def test_create_project_deploy_token(gitlab_cli, project): | ||||||||||||||||||||||||||||||
assert name in ret.stdout | ||||||||||||||||||||||||||||||
assert username in ret.stdout | ||||||||||||||||||||||||||||||
assert expires_at in ret.stdout | ||||||||||||||||||||||||||||||
assert expected_scopes in ret.stdout | ||||||||||||||||||||||||||||||
def test_create_project_deploy_token_one_scope(gitlab_cli, project): | ||||||||||||||||||||||||||||||
scopes = "read_registry" | ||||||||||||||||||||||||||||||
expected_scopes = "['read_registry']" | ||||||||||||||||||||||||||||||
do_test_create_project_deploy_token(gitlab_cli, project, scopes, expected_scopes) | ||||||||||||||||||||||||||||||
def test_create_project_deploy_token_many_scopes(gitlab_cli, project): | ||||||||||||||||||||||||||||||
scopes = "read_registry,read_repository" | ||||||||||||||||||||||||||||||
expected_scopes = "['read_repository', 'read_registry']" | ||||||||||||||||||||||||||||||
do_test_create_project_deploy_token(gitlab_cli, project, scopes, expected_scopes) | ||||||||||||||||||||||||||||||
def test_list_all_deploy_tokens(gitlab_cli, deploy_token): | ||||||||||||||||||||||||||||||