-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from qiboteam/refactor_with_abstract_client
Rename package and files to qibo-client
- Loading branch information
Showing
11 changed files
with
69 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
|
||
from .qibo_client import Client | ||
|
||
QRCCLUSTER_IP = os.environ.get("QRCCLUSTER_IP", "login.qrccluster.com") | ||
QRCCLUSTER_PORT = os.environ.get("QRCCLUSTER_PORT", "8010") | ||
BASE_URL = f"http://{QRCCLUSTER_IP}:{QRCCLUSTER_PORT}/" | ||
|
||
|
||
def TII(token: str) -> Client: | ||
"""Instantiate a TII Client object. | ||
:param token: the authentication token associated to the webapp user | ||
:type token: str | ||
:return: the client instance connected to the TII server | ||
:rtype: Client | ||
""" | ||
return Client(BASE_URL, token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from unittest.mock import Mock, patch | ||
|
||
from qibo_client import tii | ||
|
||
PKG = "qibo_client.tii" | ||
FAKE_URL = "http://tii.url.com:1234" | ||
FAKE_TOKEN = "fakeToken" | ||
|
||
|
||
@patch(f"{PKG}.BASE_URL", FAKE_URL) | ||
@patch(f"{PKG}.Client.check_client_server_qibo_versions") | ||
def test_TII(mock_method: Mock): | ||
client = tii.TII(FAKE_TOKEN) | ||
assert client.url == FAKE_URL |
File renamed without changes.