@@ -82,6 +82,7 @@ def test_ionq_client_attributes():
82
82
assert client .headers == {
83
83
'Authorization' : 'apiKey to_my_heart' ,
84
84
'Content-Type' : 'application/json' ,
85
+ 'User-Agent' : client ._user_agent (),
85
86
}
86
87
assert client .default_target == 'qpu'
87
88
assert client .max_retry_seconds == 10
@@ -108,7 +109,11 @@ def test_ionq_client_create_job(mock_post):
108
109
'shots' : '200' ,
109
110
'metadata' : {'shots' : '200' , 'a' : '0,1' },
110
111
}
111
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
112
+ expected_headers = {
113
+ 'Authorization' : 'apiKey to_my_heart' ,
114
+ 'Content-Type' : 'application/json' ,
115
+ 'User-Agent' : client ._user_agent (),
116
+ }
112
117
mock_post .assert_called_with (
113
118
'http://example.com/v0.1/jobs' , json = expected_json , headers = expected_headers
114
119
)
@@ -261,7 +266,11 @@ def test_ionq_client_get_job_retry_409(mock_get):
261
266
response = client .get_job (job_id = 'job_id' )
262
267
assert response == {'foo' : 'bar' }
263
268
264
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
269
+ expected_headers = {
270
+ 'Authorization' : 'apiKey to_my_heart' ,
271
+ 'Content-Type' : 'application/json' ,
272
+ 'User-Agent' : client ._user_agent (),
273
+ }
265
274
mock_get .assert_called_with ('http://example.com/v0.1/jobs/job_id' , headers = expected_headers )
266
275
267
276
@@ -273,7 +282,11 @@ def test_ionq_client_get_job(mock_get):
273
282
response = client .get_job (job_id = 'job_id' )
274
283
assert response == {'foo' : 'bar' }
275
284
276
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
285
+ expected_headers = {
286
+ 'Authorization' : 'apiKey to_my_heart' ,
287
+ 'Content-Type' : 'application/json' ,
288
+ 'User-Agent' : client ._user_agent (),
289
+ }
277
290
mock_get .assert_called_with ('http://example.com/v0.1/jobs/job_id' , headers = expected_headers )
278
291
279
292
@@ -336,7 +349,11 @@ def test_ionq_client_list_jobs(mock_get):
336
349
response = client .list_jobs ()
337
350
assert response == [{'id' : '1' }, {'id' : '2' }]
338
351
339
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
352
+ expected_headers = {
353
+ 'Authorization' : 'apiKey to_my_heart' ,
354
+ 'Content-Type' : 'application/json' ,
355
+ 'User-Agent' : client ._user_agent (),
356
+ }
340
357
mock_get .assert_called_with (
341
358
'http://example.com/v0.1/jobs' , headers = expected_headers , json = {'limit' : 1000 }, params = {}
342
359
)
@@ -350,7 +367,11 @@ def test_ionq_client_list_jobs_status(mock_get):
350
367
response = client .list_jobs (status = 'canceled' )
351
368
assert response == [{'id' : '1' }, {'id' : '2' }]
352
369
353
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
370
+ expected_headers = {
371
+ 'Authorization' : 'apiKey to_my_heart' ,
372
+ 'Content-Type' : 'application/json' ,
373
+ 'User-Agent' : client ._user_agent (),
374
+ }
354
375
mock_get .assert_called_with (
355
376
'http://example.com/v0.1/jobs' ,
356
377
headers = expected_headers ,
@@ -367,7 +388,11 @@ def test_ionq_client_list_jobs_limit(mock_get):
367
388
response = client .list_jobs (limit = 2 )
368
389
assert response == [{'id' : '1' }, {'id' : '2' }]
369
390
370
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
391
+ expected_headers = {
392
+ 'Authorization' : 'apiKey to_my_heart' ,
393
+ 'Content-Type' : 'application/json' ,
394
+ 'User-Agent' : client ._user_agent (),
395
+ }
371
396
mock_get .assert_called_with (
372
397
'http://example.com/v0.1/jobs' , headers = expected_headers , json = {'limit' : 1000 }, params = {}
373
398
)
@@ -385,7 +410,11 @@ def test_ionq_client_list_jobs_batches(mock_get):
385
410
response = client .list_jobs (batch_size = 1 )
386
411
assert response == [{'id' : '1' }, {'id' : '2' }, {'id' : '3' }]
387
412
388
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
413
+ expected_headers = {
414
+ 'Authorization' : 'apiKey to_my_heart' ,
415
+ 'Content-Type' : 'application/json' ,
416
+ 'User-Agent' : client ._user_agent (),
417
+ }
389
418
url = 'http://example.com/v0.1/jobs'
390
419
mock_get .assert_has_calls (
391
420
[
@@ -410,7 +439,11 @@ def test_ionq_client_list_jobs_batches_does_not_divide_total(mock_get):
410
439
response = client .list_jobs (batch_size = 2 )
411
440
assert response == [{'id' : '1' }, {'id' : '2' }, {'id' : '3' }]
412
441
413
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
442
+ expected_headers = {
443
+ 'Authorization' : 'apiKey to_my_heart' ,
444
+ 'Content-Type' : 'application/json' ,
445
+ 'User-Agent' : client ._user_agent (),
446
+ }
414
447
url = 'http://example.com/v0.1/jobs'
415
448
mock_get .assert_has_calls (
416
449
[
@@ -463,7 +496,11 @@ def test_ionq_client_cancel_job(mock_put):
463
496
response = client .cancel_job (job_id = 'job_id' )
464
497
assert response == {'foo' : 'bar' }
465
498
466
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
499
+ expected_headers = {
500
+ 'Authorization' : 'apiKey to_my_heart' ,
501
+ 'Content-Type' : 'application/json' ,
502
+ 'User-Agent' : client ._user_agent (),
503
+ }
467
504
mock_put .assert_called_with (
468
505
'http://example.com/v0.1/jobs/job_id/status/cancel' , headers = expected_headers
469
506
)
@@ -528,7 +565,11 @@ def test_ionq_client_delete_job(mock_delete):
528
565
response = client .delete_job (job_id = 'job_id' )
529
566
assert response == {'foo' : 'bar' }
530
567
531
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
568
+ expected_headers = {
569
+ 'Authorization' : 'apiKey to_my_heart' ,
570
+ 'Content-Type' : 'application/json' ,
571
+ 'User-Agent' : client ._user_agent (),
572
+ }
532
573
mock_delete .assert_called_with ('http://example.com/v0.1/jobs/job_id' , headers = expected_headers )
533
574
534
575
@@ -591,7 +632,11 @@ def test_ionq_client_get_current_calibrations(mock_get):
591
632
response = client .get_current_calibration ()
592
633
assert response == {'foo' : 'bar' }
593
634
594
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
635
+ expected_headers = {
636
+ 'Authorization' : 'apiKey to_my_heart' ,
637
+ 'Content-Type' : 'application/json' ,
638
+ 'User-Agent' : client ._user_agent (),
639
+ }
595
640
mock_get .assert_called_with (
596
641
'http://example.com/v0.1/calibrations/current' , headers = expected_headers
597
642
)
@@ -648,7 +693,11 @@ def test_ionq_client_list_calibrations(mock_get):
648
693
response = client .list_calibrations ()
649
694
assert response == [{'id' : '1' }, {'id' : '2' }]
650
695
651
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
696
+ expected_headers = {
697
+ 'Authorization' : 'apiKey to_my_heart' ,
698
+ 'Content-Type' : 'application/json' ,
699
+ 'User-Agent' : client ._user_agent (),
700
+ }
652
701
mock_get .assert_called_with (
653
702
'http://example.com/v0.1/calibrations' ,
654
703
headers = expected_headers ,
@@ -668,7 +717,11 @@ def test_ionq_client_list_calibrations_dates(mock_get):
668
717
)
669
718
assert response == [{'id' : '1' }, {'id' : '2' }]
670
719
671
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
720
+ expected_headers = {
721
+ 'Authorization' : 'apiKey to_my_heart' ,
722
+ 'Content-Type' : 'application/json' ,
723
+ 'User-Agent' : client ._user_agent (),
724
+ }
672
725
mock_get .assert_called_with (
673
726
'http://example.com/v0.1/calibrations' ,
674
727
headers = expected_headers ,
@@ -687,7 +740,11 @@ def test_ionq_client_list_calibrations_limit(mock_get):
687
740
response = client .list_calibrations (limit = 2 )
688
741
assert response == [{'id' : '1' }, {'id' : '2' }]
689
742
690
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
743
+ expected_headers = {
744
+ 'Authorization' : 'apiKey to_my_heart' ,
745
+ 'Content-Type' : 'application/json' ,
746
+ 'User-Agent' : client ._user_agent (),
747
+ }
691
748
mock_get .assert_called_with (
692
749
'http://example.com/v0.1/calibrations' ,
693
750
headers = expected_headers ,
@@ -708,7 +765,11 @@ def test_ionq_client_list_calibrations_batches(mock_get):
708
765
response = client .list_calibrations (batch_size = 1 )
709
766
assert response == [{'id' : '1' }, {'id' : '2' }, {'id' : '3' }]
710
767
711
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
768
+ expected_headers = {
769
+ 'Authorization' : 'apiKey to_my_heart' ,
770
+ 'Content-Type' : 'application/json' ,
771
+ 'User-Agent' : client ._user_agent (),
772
+ }
712
773
url = 'http://example.com/v0.1/calibrations'
713
774
mock_get .assert_has_calls (
714
775
[
@@ -733,7 +794,11 @@ def test_ionq_client_list_calibrations_batches_does_not_divide_total(mock_get):
733
794
response = client .list_calibrations (batch_size = 2 )
734
795
assert response == [{'id' : '1' }, {'id' : '2' }, {'id' : '3' }]
735
796
736
- expected_headers = {'Authorization' : 'apiKey to_my_heart' , 'Content-Type' : 'application/json' }
797
+ expected_headers = {
798
+ 'Authorization' : 'apiKey to_my_heart' ,
799
+ 'Content-Type' : 'application/json' ,
800
+ 'User-Agent' : client ._user_agent (),
801
+ }
737
802
url = 'http://example.com/v0.1/calibrations'
738
803
mock_get .assert_has_calls (
739
804
[
0 commit comments