'Ensure the function is making the right API calls based on inputs'

@override_settings(CREDENTIALS_INTERNAL_SERVICE_URL=CREDENTIALS_INTERNAL_SERVICE_URL)
@mock.patch((TASKS_MODULE + '.JwtBuilder.build_token'))
def test_get_api_client(self, mock_build_token):

    student = UserFactory()
    ClientFactory.create(name='credentials')
    api_config = self.create_credentials_config()
    mock_build_token.return_value = 'test-token'
    api_client = tasks.get_api_client(api_config, student)
    expected = (CREDENTIALS_INTERNAL_SERVICE_URL.strip('/') + '/api/v2/')
    self.assertEqual(api_client._store['base_url'], expected)
    self.assertEqual(api_client._store['session'].auth.token, 'test-token')
