diff --git a/src/qibo_client/qibo_client.py b/src/qibo_client/qibo_client.py index a60a438..d37e523 100644 --- a/src/qibo_client/qibo_client.py +++ b/src/qibo_client/qibo_client.py @@ -36,7 +36,7 @@ def check_client_server_qibo_versions(self): Raise assertion error if the two versions are not the same. """ - url = self.base_url + "/client/qibo_version/" + url = self.base_url + "/api/qibo_version/" response = QiboApiRequest.get( url, timeout=constants.TIMEOUT, @@ -110,7 +110,7 @@ def _post_circuit( device: str, nshots: int = None, ) -> QiboJob: - url = self.base_url + "/client/run_circuit/" + url = self.base_url + "/api/run_circuit/" payload = { "token": self.token, @@ -140,7 +140,7 @@ def _post_circuit( def print_quota_info(self): """Logs the formatted user quota info table.""" - url = self.base_url + "/client/info/quotas/" + url = self.base_url + "/api/info/quotas/" payload = { "token": self.token, @@ -186,7 +186,7 @@ def print_quota_info(self): def print_job_info(self): """Logs the formatted user quota info table.""" - url = self.base_url + "/client/info/jobs/" + url = self.base_url + "/api/info/jobs/" payload = { "token": self.token, @@ -209,7 +209,7 @@ def format_date(dt: str) -> str: user_set = {job["user"]["email"] for job in jobs} if len(user_set) > 1: raise ValueError( - "The `/client/info/jobs/` endpoint returned info about " + "The `/api/info/jobs/` endpoint returned info about " "multiple accounts." ) user = list(user_set)[0] diff --git a/tests/test_qibo_client.py b/tests/test_qibo_client.py index 6eb31e4..dd52af0 100644 --- a/tests/test_qibo_client.py +++ b/tests/test_qibo_client.py @@ -44,7 +44,7 @@ def setup_and_teardown(self, monkeypatch): @pytest.fixture def pass_version_check(self, monkeypatch): monkeypatch.setattr(f"{MOD}.qibo.__version__", FAKE_QIBO_VERSION) - endpoint = FAKE_URL + "/client/qibo_version/" + endpoint = FAKE_URL + "/api/qibo_version/" response_json = { "server_qibo_version": FAKE_QIBO_VERSION, "minimum_client_qibo_version": FAKE_MINIMUM_QIBO_VERSION_ALLOWED, @@ -67,7 +67,7 @@ def test_check_client_server_qibo_versions_raises_assertion_error( ): monkeypatch.setattr(f"{MOD}.qibo.__version__", FAKE_QIBO_VERSION) - endpoint = FAKE_URL + "/client/qibo_version/" + endpoint = FAKE_URL + "/api/qibo_version/" response_json = { "server_qibo_version": "0.2.9", "minimum_client_qibo_version": "0.2.8", @@ -103,7 +103,7 @@ def test_check_client_server_qibo_versions_with_warning(self, monkeypatch, caplo caplog.set_level(logging.WARNING) monkeypatch.setattr(f"{MOD}.qibo.__version__", FAKE_QIBO_VERSION) - endpoint = FAKE_URL + "/client/qibo_version/" + endpoint = FAKE_URL + "/api/qibo_version/" response_json = { "server_qibo_version": "0.2.9", "minimum_client_qibo_version": FAKE_MINIMUM_QIBO_VERSION_ALLOWED, @@ -118,7 +118,7 @@ def test_check_client_server_qibo_versions_with_warning(self, monkeypatch, caplo assert expected_log in caplog.messages def test_run_circuit_with_invalid_token(self, pass_version_check): - endpoint = FAKE_URL + "/client/run_circuit/" + endpoint = FAKE_URL + "/api/run_circuit/" message = "User not found, specify the correct token" response_json = {"detail": message} pass_version_check.add(responses.POST, endpoint, status=404, json=response_json) @@ -130,7 +130,7 @@ def test_run_circuit_with_invalid_token(self, pass_version_check): assert str(err.value) == expected_message def test_run_circuit_with_job_post_error(self, pass_version_check): - endpoint = FAKE_URL + "/client/run_circuit/" + endpoint = FAKE_URL + "/api/run_circuit/" message = "Server failed to post job to queue" response_json = {"detail": message} pass_version_check.add(responses.POST, endpoint, status=200, json=response_json) @@ -142,7 +142,7 @@ def test_run_circuit_with_job_post_error(self, pass_version_check): def test_run_circuit_with_success(self, pass_version_check, caplog): caplog.set_level(logging.INFO) - endpoint = FAKE_URL + "/client/run_circuit/" + endpoint = FAKE_URL + "/api/run_circuit/" response_json = {"pid": FAKE_PID} pass_version_check.add(responses.POST, endpoint, status=200, json=response_json) @@ -167,7 +167,7 @@ def test_run_circuit_with_success(self, pass_version_check, caplog): def test_print_quota_info(self, caplog): caplog.set_level(logging.INFO) - endpoint = FAKE_URL + "/client/info/quotas/" + endpoint = FAKE_URL + "/api/info/quotas/" response_json = { "disk_quota": { "user": {"email": FAKE_USER_EMAIL}, @@ -223,7 +223,7 @@ def test_print_quota_info(self, caplog): @responses.activate def test_print_job_info_with_success(self, caplog): caplog.set_level(logging.INFO) - endpoint = FAKE_URL + "/client/info/jobs/" + endpoint = FAKE_URL + "/api/info/jobs/" fake_creation_date = "2000-01-01T00:00:00.128372Z" formatted_creation_date = "2000-01-01 00:00:00" fake_update_date = "2000-01-02T00:00:00.128372Z" @@ -278,7 +278,7 @@ def test_print_job_info_with_success(self, caplog): @responses.activate def test_print_job_info_without_jobs(self, caplog): caplog.set_level(logging.INFO) - endpoint = FAKE_URL + "/client/info/jobs/" + endpoint = FAKE_URL + "/api/info/jobs/" responses.add(responses.POST, endpoint, status=200, json=[]) self.obj.print_job_info() @@ -289,7 +289,7 @@ def test_print_job_info_without_jobs(self, caplog): def test_print_job_info_raises_valuerror(self, caplog): caplog.set_level(logging.INFO) - endpoint = FAKE_URL + "/client/info/jobs/" + endpoint = FAKE_URL + "/api/info/jobs/" response_json = [ { "pid": FAKE_PID + "1",