def test_empty(self): # No endpoint or auth_url is configured for client. # client.discover() should be called without parameters self.client_mock.endpoint = False self.client_mock.auth_url = False shell.do_discover(self.client_mock, args=None) self.client_mock.discover.assert_called_with()
def test_auth_url(self): # No endpoint provided for client, but there is an auth_url # client's discover method should be called with auth_url value self.client_mock.endpoint = False self.client_mock.auth_url = 'Some non-empty value' shell.do_discover(self.client_mock, args=None) self.client_mock.discover.assert_called_with(self.client_mock.auth_url)
def _execute_discover(self): """Call do_discover function and capture output :return: captured output is returned """ with mock.patch('sys.stdout', new_callable=moves.StringIO) as mock_stdout: shell.do_discover(self.client_mock, args=None) output = mock_stdout.getvalue() return output
def test_endpoint(self): # Endpoint is configured for client, # client's discover method should be called with that value self.client_mock.endpoint = 'Some non-empty value' shell.do_discover(self.client_mock, args=None) self.client_mock.discover.assert_called_with(self.client_mock.endpoint)