コード例 #1
0
    def _get_api(qe_token, qe_url):
        """Helper for instantating an IBMQConnector."""
        if ('quantum-computing.ibm.com/api' in qe_url and
                'auth' in qe_url):
            raise SkipTest('Classic api URL not provided')

        return IBMQConnector(qe_token, config={'url': qe_url})
コード例 #2
0
 def test_invalid_token(self):
     """Test using an invalid token"""
     with self.assertRaises(ApiError):
         _ = IBMQConnector('INVALID_TOKEN')
コード例 #3
0
 def test_url_unreachable(self, qe_token, qe_url):
     """Test accessing an invalid URL"""
     # pylint: disable=unused-argument
     with self.assertRaises(ApiError):
         _ = IBMQConnector(qe_token, config={'url': 'INVALID_URL'})
コード例 #4
0
 def test_url_404(self, qe_token, qe_url):
     """Test accessing a 404 URL"""
     url_404 = re.sub(r'/api.*$', '/api/TEST_404', qe_url)
     with self.assertRaises(ApiError):
         _ = IBMQConnector(qe_token,
                           config={'url': url_404})
コード例 #5
0
 def _get_api(qe_token, qe_url):
     """Helper for instantating an IBMQConnector."""
     return IBMQConnector(qe_token, config={'url': qe_url})
コード例 #6
0
 def test_url_unreachable(self, qe_token, qe_url):
     """Test accessing an invalid URL"""
     qe_url = 'INVALID_URL'
     with self.assertRaises(ApiError):
         _ = IBMQConnector(qe_token, config={'url': qe_url})
コード例 #7
0
 def test_invalid_token(self, qe_token, qe_url):
     """Test using an invalid token"""
     qe_token = 'INVALID_TOKEN'
     with self.assertRaises(ApiError):
         _ = IBMQConnector(qe_token, config={'url': qe_url})
コード例 #8
0
    def _get_api(qe_token, qe_url):
        """Helper for instantating an IBMQConnector."""
        if ('quantum-computing.ibm.com/api' in qe_url and 'auth' in qe_url):
            raise SkipTest('Test needs credentials for classic API')

        return IBMQConnector(qe_token, config={'url': qe_url})