From 225301798cc01754402dd40e96b1db9495f6ccf3 Mon Sep 17 00:00:00 2001 From: Michael Wurster Date: Fri, 2 Feb 2024 09:53:11 +0100 Subject: [PATCH] fix: remove unused methods --- .gitignore | 6 ++---- planqk/qiskit/provider.py | 9 --------- tests/integration/test_credentials.py | 7 ++++--- tests/unit/planqk/test_job.py | 7 +++++-- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 5c065df..7d36094 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/planqk/qiskit/provider.py b/planqk/qiskit/provider.py index d7a84e7..d805412 100644 --- a/planqk/qiskit/provider.py +++ b/planqk/qiskit/provider.py @@ -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 diff --git a/tests/integration/test_credentials.py b/tests/integration/test_credentials.py index 637fa80..685e937 100644 --- a/tests/integration/test_credentials.py +++ b/tests/integration/test_credentials.py @@ -3,6 +3,7 @@ import unittest.mock from planqk.qiskit import PlanqkQuantumProvider +from planqk.qiskit.client.client import _PlanqkClient class CredentialsTestSuite(unittest.TestCase): @@ -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" @@ -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 = """ @@ -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") diff --git a/tests/unit/planqk/test_job.py b/tests/unit/planqk/test_job.py index 230e0c0..8b529e4 100644 --- a/tests/unit/planqk/test_job.py +++ b/tests/unit/planqk/test_job.py @@ -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): @@ -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()