Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturKamalov committed Apr 30, 2024
1 parent 2f18e84 commit 64c234e
Show file tree
Hide file tree
Showing 2 changed files with 222 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
interactions:
- request:
body: client_id=PLACEHOLDER&grant_type=client_credentials&client_info=1&client_secret=PLACEHOLDER&scope=https%3A%2F%2Fquantum.microsoft.com%2F.default
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '144'
Content-Type:
- application/x-www-form-urlencoded
User-Agent:
- azsdk-python-identity/1.16.0 Python/3.9.19 (Windows-10-10.0.22631-SP0)
x-client-current-telemetry:
- 4|730,2|
x-client-os:
- win32
x-client-sku:
- MSAL.Python
x-client-ver:
- 1.28.0
method: POST
uri: https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token
response:
body:
string: '{"error": "invalid_client", "error_description": "AADSTS7000215: Invalid
client secret provided. Ensure the secret being sent in the request is the
client secret value, not the client secret ID, for a secret added to app ''00000000-0000-0000-0000-000000000000''.
Trace ID: 3f843fef-9742-4217-a625-4f2e55c78000 Correlation ID: 20082687-ff18-4cb7-918a-5e1235decb49
Timestamp: 2024-04-30 15:19:34Z", "error_codes": [7000215], "timestamp": "2024-04-30
15:19:34Z", "trace_id": "3f843fef-9742-4217-a625-4f2e55c78000", "correlation_id":
"20082687-ff18-4cb7-918a-5e1235decb49", "error_uri": "https://login.microsoftonline.com/error?code=7000215"}'
headers:
content-length:
- '636'
content-type:
- application/json; charset=utf-8
status:
code: 401
message: Unauthorized
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- testapp azsdk-python-quantum/0.0.1 Python/3.9.19 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.quantum.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Quantum/workspaces/myworkspace/providerStatus?api-version=2022-09-12-preview&test-sequence-id=1
response:
body:
string: '{"value": [{"id": "microsoft-elements", "currentAvailability": "Available",
"targets": [{"id": "microsoft.dft", "currentAvailability": "Available", "averageQueueTime":
0, "statusPage": null}]}, {"id": "ionq", "currentAvailability": "Degraded",
"targets": [{"id": "ionq.qpu", "currentAvailability": "Available", "averageQueueTime":
387740, "statusPage": "https://status.ionq.co"}, {"id": "ionq.qpu.aria-1",
"currentAvailability": "Unavailable", "averageQueueTime": 750226, "statusPage":
"https://status.ionq.co"}, {"id": "ionq.qpu.aria-2", "currentAvailability":
"Unavailable", "averageQueueTime": 0, "statusPage": "https://status.ionq.co"},
{"id": "ionq.simulator", "currentAvailability": "Available", "averageQueueTime":
2, "statusPage": "https://status.ionq.co"}]}, {"id": "microsoft-qc", "currentAvailability":
"Available", "targets": [{"id": "microsoft.estimator", "currentAvailability":
"Available", "averageQueueTime": 0, "statusPage": null}]}, {"id": "pasqal",
"currentAvailability": "Available", "targets": [{"id": "pasqal.sim.emu-tn",
"currentAvailability": "Available", "averageQueueTime": 318, "statusPage":
"https://pasqal.com"}, {"id": "pasqal.qpu.fresnel", "currentAvailability":
"Available", "averageQueueTime": 1344, "statusPage": "https://pasqal.com"}]},
{"id": "rigetti", "currentAvailability": "Degraded", "targets": [{"id": "rigetti.sim.qvm",
"currentAvailability": "Available", "averageQueueTime": 5, "statusPage": "https://rigetti.statuspage.io/"},
{"id": "rigetti.qpu.ankaa-2", "currentAvailability": "Degraded", "averageQueueTime":
5, "statusPage": "https://rigetti.statuspage.io/"}]}, {"id": "qci", "currentAvailability":
"Available", "targets": [{"id": "qci.simulator", "currentAvailability": "Available",
"averageQueueTime": 1, "statusPage": "https://quantumcircuits.com"}, {"id":
"qci.machine1", "currentAvailability": "Available", "averageQueueTime": 1,
"statusPage": "https://quantumcircuits.com"}, {"id": "qci.simulator.noisy",
"currentAvailability": "Available", "averageQueueTime": 0, "statusPage": "https://quantumcircuits.com"}]},
{"id": "quantinuum", "currentAvailability": "Degraded", "targets": [{"id":
"quantinuum.qpu.h1-1", "currentAvailability": "Degraded", "averageQueueTime":
0, "statusPage": "https://www.quantinuum.com/hardware/h1"}, {"id": "quantinuum.sim.h1-1sc",
"currentAvailability": "Available", "averageQueueTime": 2, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.sim.h1-1e", "currentAvailability": "Available", "averageQueueTime":
355, "statusPage": "https://www.quantinuum.com/hardware/h1"}, {"id": "quantinuum.qpu.h2-1",
"currentAvailability": "Degraded", "averageQueueTime": 0, "statusPage": "https://www.quantinuum.com/hardware/h2"},
{"id": "quantinuum.sim.h2-1sc", "currentAvailability": "Available", "averageQueueTime":
0, "statusPage": "https://www.quantinuum.com/hardware/h2"}, {"id": "quantinuum.sim.h2-1e",
"currentAvailability": "Available", "averageQueueTime": 912, "statusPage":
"https://www.quantinuum.com/hardware/h2"}, {"id": "quantinuum.sim.h1-1sc-preview",
"currentAvailability": "Available", "averageQueueTime": 2, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.sim.h1-1e-preview", "currentAvailability": "Available",
"averageQueueTime": 355, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.sim.h1-2e-preview", "currentAvailability": "Available",
"averageQueueTime": 15089, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.qpu.h1-1-preview", "currentAvailability": "Degraded", "averageQueueTime":
0, "statusPage": "https://www.quantinuum.com/hardware/h1"}]}, {"id": "Microsoft.Test",
"currentAvailability": "Available", "targets": [{"id": "echo-rigetti", "currentAvailability":
"Available", "averageQueueTime": 1, "statusPage": ""}, {"id": "echo-quantinuum",
"currentAvailability": "Available", "averageQueueTime": 1, "statusPage": ""},
{"id": "echo-qci", "currentAvailability": "Available", "averageQueueTime":
1, "statusPage": ""}, {"id": "echo-ionq", "currentAvailability": "Available",
"averageQueueTime": 1, "statusPage": ""}, {"id": "echo-aquarius", "currentAvailability":
"Available", "averageQueueTime": 1, "statusPage": ""}, {"id": "sparse-sim-rigetti",
"currentAvailability": "Available", "averageQueueTime": 1, "statusPage": ""},
{"id": "sparse-sim-quantinuum", "currentAvailability": "Available", "averageQueueTime":
1, "statusPage": ""}, {"id": "sparse-sim-qci", "currentAvailability": "Available",
"averageQueueTime": 1, "statusPage": ""}, {"id": "sparse-sim-ionq", "currentAvailability":
"Available", "averageQueueTime": 1, "statusPage": ""}, {"id": "echo-output",
"currentAvailability": "Available", "averageQueueTime": 1, "statusPage": ""}]}],
"nextLink": null}'
headers:
connection:
- keep-alive
content-length:
- '4764'
content-type:
- application/json; charset=utf-8
transfer-encoding:
- chunked
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- testapp azsdk-python-quantum/0.0.1 Python/3.9.19 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://eastus.quantum.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Quantum/workspaces/myworkspace/providerStatus?api-version=2022-09-12-preview&test-sequence-id=2
response:
body:
string: '{"value": [{"id": "microsoft-elements", "currentAvailability": "Available",
"targets": [{"id": "microsoft.dft", "currentAvailability": "Available", "averageQueueTime":
0, "statusPage": null}]}, {"id": "ionq", "currentAvailability": "Degraded",
"targets": [{"id": "ionq.qpu", "currentAvailability": "Available", "averageQueueTime":
387740, "statusPage": "https://status.ionq.co"}, {"id": "ionq.qpu.aria-1",
"currentAvailability": "Unavailable", "averageQueueTime": 750226, "statusPage":
"https://status.ionq.co"}, {"id": "ionq.qpu.aria-2", "currentAvailability":
"Unavailable", "averageQueueTime": 0, "statusPage": "https://status.ionq.co"},
{"id": "ionq.simulator", "currentAvailability": "Available", "averageQueueTime":
2, "statusPage": "https://status.ionq.co"}]}, {"id": "microsoft-qc", "currentAvailability":
"Available", "targets": [{"id": "microsoft.estimator", "currentAvailability":
"Available", "averageQueueTime": 0, "statusPage": null}]}, {"id": "pasqal",
"currentAvailability": "Available", "targets": [{"id": "pasqal.sim.emu-tn",
"currentAvailability": "Available", "averageQueueTime": 318, "statusPage":
"https://pasqal.com"}, {"id": "pasqal.qpu.fresnel", "currentAvailability":
"Available", "averageQueueTime": 1344, "statusPage": "https://pasqal.com"}]},
{"id": "rigetti", "currentAvailability": "Degraded", "targets": [{"id": "rigetti.sim.qvm",
"currentAvailability": "Available", "averageQueueTime": 5, "statusPage": "https://rigetti.statuspage.io/"},
{"id": "rigetti.qpu.ankaa-2", "currentAvailability": "Degraded", "averageQueueTime":
5, "statusPage": "https://rigetti.statuspage.io/"}]}, {"id": "qci", "currentAvailability":
"Available", "targets": [{"id": "qci.simulator", "currentAvailability": "Available",
"averageQueueTime": 1, "statusPage": "https://quantumcircuits.com"}, {"id":
"qci.machine1", "currentAvailability": "Available", "averageQueueTime": 1,
"statusPage": "https://quantumcircuits.com"}, {"id": "qci.simulator.noisy",
"currentAvailability": "Available", "averageQueueTime": 0, "statusPage": "https://quantumcircuits.com"}]},
{"id": "quantinuum", "currentAvailability": "Degraded", "targets": [{"id":
"quantinuum.qpu.h1-1", "currentAvailability": "Degraded", "averageQueueTime":
0, "statusPage": "https://www.quantinuum.com/hardware/h1"}, {"id": "quantinuum.sim.h1-1sc",
"currentAvailability": "Available", "averageQueueTime": 2, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.sim.h1-1e", "currentAvailability": "Available", "averageQueueTime":
355, "statusPage": "https://www.quantinuum.com/hardware/h1"}, {"id": "quantinuum.qpu.h2-1",
"currentAvailability": "Degraded", "averageQueueTime": 0, "statusPage": "https://www.quantinuum.com/hardware/h2"},
{"id": "quantinuum.sim.h2-1sc", "currentAvailability": "Available", "averageQueueTime":
0, "statusPage": "https://www.quantinuum.com/hardware/h2"}, {"id": "quantinuum.sim.h2-1e",
"currentAvailability": "Available", "averageQueueTime": 912, "statusPage":
"https://www.quantinuum.com/hardware/h2"}, {"id": "quantinuum.sim.h1-1sc-preview",
"currentAvailability": "Available", "averageQueueTime": 2, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.sim.h1-1e-preview", "currentAvailability": "Available",
"averageQueueTime": 355, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.sim.h1-2e-preview", "currentAvailability": "Available",
"averageQueueTime": 15089, "statusPage": "https://www.quantinuum.com/hardware/h1"},
{"id": "quantinuum.qpu.h1-1-preview", "currentAvailability": "Degraded", "averageQueueTime":
0, "statusPage": "https://www.quantinuum.com/hardware/h1"}]}, {"id": "Microsoft.Test",
"currentAvailability": "Available", "targets": [{"id": "echo-rigetti", "currentAvailability":
"Available", "averageQueueTime": 1, "statusPage": ""}, {"id": "echo-quantinuum",
"currentAvailability": "Available", "averageQueueTime": 1, "statusPage": ""},
{"id": "echo-qci", "currentAvailability": "Available", "averageQueueTime":
1, "statusPage": ""}, {"id": "echo-ionq", "currentAvailability": "Available",
"averageQueueTime": 1, "statusPage": ""}, {"id": "echo-aquarius", "currentAvailability":
"Available", "averageQueueTime": 1, "statusPage": ""}, {"id": "sparse-sim-rigetti",
"currentAvailability": "Available", "averageQueueTime": 1, "statusPage": ""},
{"id": "sparse-sim-quantinuum", "currentAvailability": "Available", "averageQueueTime":
1, "statusPage": ""}, {"id": "sparse-sim-qci", "currentAvailability": "Available",
"averageQueueTime": 1, "statusPage": ""}, {"id": "sparse-sim-ionq", "currentAvailability":
"Available", "averageQueueTime": 1, "statusPage": ""}, {"id": "echo-output",
"currentAvailability": "Available", "averageQueueTime": 1, "statusPage": ""}]}],
"nextLink": null}'
headers:
connection:
- keep-alive
content-length:
- '4764'
content-type:
- application/json; charset=utf-8
transfer-encoding:
- chunked
status:
code: 200
message: OK
version: 1
10 changes: 10 additions & 0 deletions azure-quantum/tests/unit/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ def test_workspace_get_target_ionq(self):
target.name = "foo"
target.refresh()

@pytest.mark.live_test
def test_workspace_get_targets_result_type(self):
ws = self.create_workspace()
targets = ws.get_targets()
assert isinstance(targets, list)
# For now, we keep a single result as instance instead of list,
# but it has to be changed in the next major release.
target = ws.get_targets(name="ionq.qpu")
assert not isinstance(target, list)

@pytest.mark.microsoft_qc
@pytest.mark.live_test
def test_workspace_get_target_microsoft_qc(self):
Expand Down

0 comments on commit 64c234e

Please sign in to comment.