diff options
Diffstat (limited to 'tests/functional/cli')
-rw-r--r-- | tests/functional/cli/conftest.py | 9 | ||||
-rw-r--r-- | tests/functional/cli/test_cli_projects.py | 27 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/functional/cli/conftest.py b/tests/functional/cli/conftest.py index 4311339..d846cc7 100644 --- a/tests/functional/cli/conftest.py +++ b/tests/functional/cli/conftest.py @@ -33,3 +33,12 @@ def resp_get_project(): "content_type": "application/json", "status": 200, } + + +@pytest.fixture +def resp_delete_registry_tags_in_bulk(): + return { + "method": responses.DELETE, + "url": f"{DEFAULT_URL}/api/v4/projects/1/registry/repositories/1/tags", + "status": 202, + } diff --git a/tests/functional/cli/test_cli_projects.py b/tests/functional/cli/test_cli_projects.py new file mode 100644 index 0000000..bf7f564 --- /dev/null +++ b/tests/functional/cli/test_cli_projects.py @@ -0,0 +1,27 @@ +import pytest +import responses + + +@pytest.mark.script_launch_mode("inprocess") +@responses.activate +def test_project_registry_delete_in_bulk( + script_runner, resp_delete_registry_tags_in_bulk +): + responses.add(**resp_delete_registry_tags_in_bulk) + cmd = [ + "gitlab", + "project-registry-tag", + "delete-in-bulk", + "--project-id", + "1", + "--repository-id", + "1", + "--name-regex-delete", + "^.*dev.*$", + # TODO: remove `name` after deleting without ID is possible + # See #849 and #1631 + "--name", + ".*", + ] + ret = ret = script_runner.run(*cmd) + assert ret.success |