1919
2020
2121def test_main_entrypoint (script_runner ,gitlab_config ):
22- ret = script_runner .run ("python" ,"-m" ,"gitlab" ,"--config-file" ,gitlab_config )
22+ ret = script_runner .run ([ "python" ,"-m" ,"gitlab" ,"--config-file" ,gitlab_config ] )
2323assert ret .returncode == 2
2424
2525
2626def test_version (script_runner ):
27- ret = script_runner .run ("gitlab" ,"--version" )
27+ ret = script_runner .run ([ "gitlab" ,"--version" ] )
2828assert ret .stdout .strip ()== __version__
2929
3030
3131def test_config_error_with_help_prints_help (script_runner ):
32- ret = script_runner .run ("gitlab" ,"-c" ,"invalid-file" ,"--help" )
32+ ret = script_runner .run ([ "gitlab" ,"-c" ,"invalid-file" ,"--help" ] )
3333assert ret .stdout .startswith ("usage:" )
3434assert ret .returncode == 0
3535
3636
3737def test_global_help_prints_resources_vertically (script_runner ):
38- ret = script_runner .run ("gitlab" ,"--help" )
38+ ret = script_runner .run ([ "gitlab" ,"--help" ] )
3939assert """resource:\n application\n application-appearance\n """ in ret .stdout
4040assert ret .returncode == 0
4141
4242
4343def test_resource_help_prints_actions_vertically (script_runner ):
44- ret = script_runner .run ("gitlab" ,"project" ,"--help" )
44+ ret = script_runner .run ([ "gitlab" ,"project" ,"--help" ] )
4545assert """action:\n list\n get""" in ret .stdout
4646assert ret .returncode == 0
4747
@@ -51,7 +51,7 @@ def test_resource_help_prints_actions_vertically(script_runner):
5151def test_defaults_to_gitlab_com (script_runner ,resp_get_project ,monkeypatch ):
5252responses .add (** resp_get_project )
5353monkeypatch .setattr (config ,"_DEFAULT_FILES" , [])
54- ret = script_runner .run ("gitlab" ,"project" ,"get" ,"--id" ,"1" )
54+ ret = script_runner .run ([ "gitlab" ,"project" ,"get" ,"--id" ,"1" ] )
5555assert ret .success
5656assert "id: 1" in ret .stdout
5757
@@ -65,7 +65,7 @@ def test_uses_ci_server_url(monkeypatch, script_runner, resp_get_project):
6565resp_get_project_in_ci .update (url = f"{ CI_SERVER_URL } /api/v4/projects/1" )
6666
6767responses .add (** resp_get_project_in_ci )
68- ret = script_runner .run ("gitlab" ,"project" ,"get" ,"--id" ,"1" )
68+ ret = script_runner .run ([ "gitlab" ,"project" ,"get" ,"--id" ,"1" ] )
6969assert ret .success
7070
7171
@@ -80,7 +80,7 @@ def test_uses_ci_job_token(monkeypatch, script_runner, resp_get_project):
8080 )
8181
8282responses .add (** resp_get_project_in_ci )
83- ret = script_runner .run ("gitlab" ,"project" ,"get" ,"--id" ,"1" )
83+ ret = script_runner .run ([ "gitlab" ,"project" ,"get" ,"--id" ,"1" ] )
8484assert ret .success
8585
8686
@@ -104,47 +104,47 @@ def test_private_token_overrides_job_token(
104104
105105responses .add (** resp_get_project_with_token )
106106responses .add (** resp_auth_with_token )
107- ret = script_runner .run ("gitlab" ,"project" ,"get" ,"--id" ,"1" )
107+ ret = script_runner .run ([ "gitlab" ,"project" ,"get" ,"--id" ,"1" ] )
108108assert ret .success
109109
110110
111111def test_env_config_missing_file_raises (script_runner ,monkeypatch ):
112112monkeypatch .setenv ("PYTHON_GITLAB_CFG" ,"non-existent" )
113- ret = script_runner .run ("gitlab" ,"project" ,"list" )
113+ ret = script_runner .run ([ "gitlab" ,"project" ,"list" ] )
114114assert not ret .success
115115assert ret .stderr .startswith ("Cannot read config from PYTHON_GITLAB_CFG" )
116116
117117
118118def test_arg_config_missing_file_raises (script_runner ):
119119ret = script_runner .run (
120- "gitlab" ,"--config-file" ,"non-existent" ,"project" ,"list"
120+ [ "gitlab" ,"--config-file" ,"non-existent" ,"project" ,"list" ]
121121 )
122122assert not ret .success
123123assert ret .stderr .startswith ("Cannot read config from file" )
124124
125125
126126def test_invalid_config (script_runner ):
127- ret = script_runner .run ("gitlab" ,"--gitlab" ,"invalid" )
127+ ret = script_runner .run ([ "gitlab" ,"--gitlab" ,"invalid" ] )
128128assert not ret .success
129129assert not ret .stdout
130130
131131
132132def test_invalid_config_prints_help (script_runner ):
133- ret = script_runner .run ("gitlab" ,"--gitlab" ,"invalid" ,"--help" )
133+ ret = script_runner .run ([ "gitlab" ,"--gitlab" ,"invalid" ,"--help" ] )
134134assert ret .success
135135assert ret .stdout
136136
137137
138138def test_invalid_api_version (script_runner ,monkeypatch ,fixture_dir ):
139139monkeypatch .setenv ("PYTHON_GITLAB_CFG" ,str (fixture_dir / "invalid_version.cfg" ))
140- ret = script_runner .run ("gitlab" ,"--gitlab" ,"test" ,"project" ,"list" )
140+ ret = script_runner .run ([ "gitlab" ,"--gitlab" ,"test" ,"project" ,"list" ] )
141141assert not ret .success
142142assert ret .stderr .startswith ("Unsupported API version:" )
143143
144144
145145def test_invalid_auth_config (script_runner ,monkeypatch ,fixture_dir ):
146146monkeypatch .setenv ("PYTHON_GITLAB_CFG" ,str (fixture_dir / "invalid_auth.cfg" ))
147- ret = script_runner .run ("gitlab" ,"--gitlab" ,"test" ,"project" ,"list" )
147+ ret = script_runner .run ([ "gitlab" ,"--gitlab" ,"test" ,"project" ,"list" ] )
148148assert not ret .success
149149assert "401" in ret .stderr
150150