Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proxy pass through test #1014

Merged
merged 3 commits into from
Oct 3, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/python/ibmq/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from qiskit.backends.ibmq.credentials._environ import VARIABLES_MAP
from qiskit.backends.ibmq.ibmqprovider import QE_URL
from qiskit.backends.ibmq.ibmqsingleprovider import IBMQSingleProvider
from ..common import QiskitTestCase
from ..common import QiskitTestCase, requires_qe_access


IBMQ_TEMPLATE = 'https://localhost/api/Hubs/{}/Groups/{}/Projects/{}'
Expand Down Expand Up @@ -143,6 +143,20 @@ def test_delete_all_accounts(self):
self.assertEqual(len(qiskit.IBMQ._accounts), 0)
self.assertEqual(len(read_credentials_from_qiskitrc()), 0)

@requires_qe_access
def test_pass_bad_proxy(self, qe_token, qe_url):
"""Test proxy pass through."""
prox = {'urls': {
'http': 'http://user:[email protected]:5678',
'https': 'https://user:[email protected]:5678'}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace the host with either an invalid one, or one that resolves quickly: perhaps 127.0.0.1? This way hopefully we avoid the delay, while still getting the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

failed = False
try:
qiskit.IBMQ.enable_account(qe_token, qe_url, proxies=prox)
except ConnectionError as excep:
if 'ProxyError' in str(excep):
failed = True
self.assertTrue(failed)


# TODO: NamedTemporaryFiles do not support name in Windows
@skipIf(os.name == 'nt', 'Test not supported in Windows')
Expand Down