def test_connect_direct_scheduler_with_user_agent(mock_transport): mock_transport.return_value.open.side_effect = [ TTransport.TTransportException, True ] mock_time = mock.create_autospec(spec=time, instance=True) user_agent = 'Some-User-Agent' uri = 'https://scheduler.example.com:1337' client = scheduler_client.DirectSchedulerClient(uri, verbose=True, user_agent=user_agent) client._connect_scheduler(uri, mock_time) mock_transport.assert_called_once_with(uri, user_agent=user_agent)
def test_connect_direct_scheduler_with_user_agent(self, mock_transport): mock_transport.return_value.open.side_effect = [ TTransport.TTransportException, True ] mock_time = mock.create_autospec(spec=time, instance=True) auth = mock_auth() user_agent = 'Some-User-Agent' uri = 'https://scheduler.example.com:1337' cluster = Cluster(scheduler_uri=uri) client = scheduler_client.DirectSchedulerClient(cluster, auth=auth, verbose=True, user_agent=user_agent) client._connect_scheduler(uri, mock_time) mock_transport.assert_called_once_with(uri, auth=auth.auth(), user_agent=user_agent, session_factory=mock.ANY)