Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
fix: remove unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
miwurster committed Feb 2, 2024
1 parent 2a5b3e5 commit 2253017
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,5 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/pydev,linux,macos,python,windows,intellij+all
/tests/acceptance/backends/
/tests/acceptance/.env
/tests/acceptance/__init__.py
/tests/acceptance/backends alias

tests/acceptance
9 changes: 0 additions & 9 deletions planqk/qiskit/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,3 @@ def get_backend(self, name=None, provider: PROVIDER = None, **kwargs):
return PlanqkIbmBackend(**backend_init_params)
else:
return PlanqkBackend(**backend_init_params)

@staticmethod
def get_access_token():
"""Returns the access token used for authentication with PlanQK."""
return _PlanqkClient.get_credentials().get_access_token()

@property
def provider_token(self):
return self._provider_token
7 changes: 4 additions & 3 deletions tests/integration/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import unittest.mock

from planqk.qiskit import PlanqkQuantumProvider
from planqk.qiskit.client.client import _PlanqkClient


class CredentialsTestSuite(unittest.TestCase):
Expand All @@ -18,7 +19,7 @@ def tearDown(self):
def test_should_use_user_provided_token(self):
access_token = "user_access_token"
planqk_provider = PlanqkQuantumProvider(access_token)
self.assertEqual(planqk_provider.get_access_token(), access_token)
self.assertEqual(access_token, _PlanqkClient.get_credentials().get_access_token())

def test_env_provided_token_priority(self):
access_token = "service_access_token"
Expand All @@ -27,7 +28,7 @@ def test_env_provided_token_priority(self):
planqk_provider = PlanqkQuantumProvider("user_access_token")

# env set token must have priority to access token set by user
self.assertEqual("user_access_token", planqk_provider.get_access_token())
self.assertEqual("user_access_token", _PlanqkClient.get_credentials().get_access_token())

def test_should_get_access_token_from_config_file(self):
json_value = """
Expand All @@ -44,6 +45,6 @@ def test_should_get_access_token_from_config_file(self):

planqk_provider = PlanqkQuantumProvider()

access_token = planqk_provider.get_access_token()
access_token = _PlanqkClient.get_credentials().get_access_token()
self.assertIsNotNone(access_token)
self.assertEqual(access_token, "plqk_test")
7 changes: 5 additions & 2 deletions tests/unit/planqk/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
from planqk.qiskit.client.job_dtos import JobDto


class TestBackend(BackendV2, ABC):
class MockBackend(BackendV2, ABC):

def __init__(self, **kwargs):
super().__init__(**kwargs)

@property
def target(self):
Expand All @@ -28,7 +31,7 @@ def run(self, run_input, **options):
class JobTestSuite(unittest.TestCase):

def test_job_should_have_queue_position_attribute(self):
backend = TestBackend()
backend = MockBackend()
job = PlanqkJob(backend, job_id="1337", job_details=JobDto(**{"provider": "TEST"}))

queue_position = job.queue_position()
Expand Down

0 comments on commit 2253017

Please sign in to comment.