Create client for interactive shell

The client allows you to run an interactive mode that doesn't exit
between calls and reuses the client which is handy for end users.
Currently the code doesn't actually create a workflow engine client in
the interactive mode so all the mistral actions fail. We should create a
client if the client doesn't pass any args to the shell because that
enters interactive mode.

Change-Id: I8b4c56277f0f172da712f777c4c856dba6fa0b0b
Closes-Bug: #1861357
This commit is contained in:
Alex Schultz 2020-01-29 16:51:54 -07:00
parent 23270d272a
commit 5171cdd63a
2 changed files with 8 additions and 2 deletions

View File

@ -565,8 +565,7 @@ class MistralShell(app.App):
('bash-completion' in argv) or
('help' in argv) or
('-h' in argv) or
('--help' in argv) or
not argv)
('--help' in argv))
# Set default for auth_url if not supplied. The default is not
# set at the parser to support use cases where auth is not enabled.

View File

@ -39,6 +39,13 @@ class TestShell(base.BaseShellTests):
params = client_mock.call_args
self.assertEqual('', params[1]['mistral_url'])
@mock.patch('mistralclient.api.client.client')
def test_command_interactive_mode(self, client_mock):
self.shell('')
self.assertTrue(client_mock.called)
params = client_mock.call_args
self.assertEqual('', params[1]['mistral_url'])
@mock.patch('mistralclient.api.client.client')
def test_command_with_mistral_url(self, client_mock):
self.shell(