diff options
| author | Dr. Jens Harbott <harbott@osism.tech> | 2022-11-15 08:57:26 +0100 |
|---|---|---|
| committer | Dr. Jens Harbott <harbott@osism.tech> | 2023-02-15 09:42:45 +0100 |
| commit | 7506eb8e0c459494bdb4ec47de2e18a2a953d727 (patch) | |
| tree | 736a65c068c7f695593a5829eb4a65719d66ccfc /openstackclient/tests | |
| parent | 69182a04b223824b5da1aeca253c815a9affedbc (diff) | |
| download | python-openstackclient-7506eb8e0c459494bdb4ec47de2e18a2a953d727.tar.gz | |
Add auto-approve option to project cleanup
Sometimes it is useful to be able to use the project cleanup function in
scripts and having to add "echo y | openstack" isn't really nice.
Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I3ded9982769b4568b6dcfc49bc31ba67a6227839
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/unit/common/test_project_cleanup.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/common/test_project_cleanup.py b/openstackclient/tests/unit/common/test_project_cleanup.py index d235aeb0..50c434b9 100644 --- a/openstackclient/tests/unit/common/test_project_cleanup.py +++ b/openstackclient/tests/unit/common/test_project_cleanup.py @@ -85,6 +85,32 @@ class TestProjectCleanup(TestProjectCleanupBase): self.assertIsNone(result) + def test_project_cleanup_with_auto_approve(self): + arglist = [ + '--project', self.project.id, + '--auto-approve', + ] + verifylist = [ + ('dry_run', False), + ('auth_project', False), + ('project', self.project.id), + ('auto_approve', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = None + + result = self.cmd.take_action(parsed_args) + + self.sdk_connect_as_project_mock.assert_called_with( + self.project) + calls = [ + mock.call(dry_run=True, status_queue=mock.ANY, filters={}), + mock.call(dry_run=False, status_queue=mock.ANY, filters={}) + ] + self.project_cleanup_mock.assert_has_calls(calls) + + self.assertIsNone(result) + def test_project_cleanup_with_project(self): arglist = [ '--project', self.project.id, |
