-
Notifications
You must be signed in to change notification settings - Fork 38
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 #1114 from rjmello/compute-client-misc-methods
Add ComputeClientV2 version and AMQP info methods
- Loading branch information
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelog.d/20241125_154944_30907815+rjmello_compute_client_misc_methods.rst
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,5 @@ | ||
Added | ||
~~~~~ | ||
|
||
- Added the ``ComputeClientV2.get_version()`` and ``ComputeClientV2.get_result_amqp_url()`` | ||
methods. (:pr:`NUMBER`) |
15 changes: 15 additions & 0 deletions
15
src/globus_sdk/_testing/data/compute/v2/get_result_amqp_url.py
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,15 @@ | ||
from globus_sdk._testing.models import RegisteredResponse, ResponseSet | ||
|
||
DEFAULT_RESPONSE_DOC = { | ||
"queue_prefix": "some_prefix", | ||
"connection_url": "amqps://user:[email protected]", | ||
} | ||
|
||
RESPONSES = ResponseSet( | ||
default=RegisteredResponse( | ||
service="compute", | ||
path="/v2/get_amqp_result_connection_url", | ||
method="GET", | ||
json=DEFAULT_RESPONSE_DOC, | ||
), | ||
) |
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,28 @@ | ||
from responses.matchers import query_param_matcher | ||
|
||
from globus_sdk._testing.models import RegisteredResponse, ResponseSet | ||
|
||
API_VERSION = "1.23.0" | ||
ALL_RESPONSE_DOC = { | ||
"api": API_VERSION, | ||
"min_sdk_version": "1.0.0a6", | ||
"min_endpoint_version": "1.0.0a0", | ||
"git_sha": "80b2ef87bc546b3b386cf2e1d372f4be50f10bc4", | ||
} | ||
|
||
RESPONSES = ResponseSet( | ||
metadata={"api_version": API_VERSION}, | ||
default=RegisteredResponse( | ||
service="compute", | ||
path="/v2/version", | ||
method="GET", | ||
json=API_VERSION, # type: ignore[arg-type] | ||
), | ||
all=RegisteredResponse( | ||
service="compute", | ||
path="/v2/version", | ||
method="GET", | ||
json=ALL_RESPONSE_DOC, | ||
match=[query_param_matcher(params={"service": "all"})], | ||
), | ||
) |
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
9 changes: 9 additions & 0 deletions
9
tests/functional/services/compute/v2/test_get_result_amqp_url.py
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,9 @@ | ||
import globus_sdk | ||
from globus_sdk._testing import load_response | ||
|
||
|
||
def test_get_result_amqp_url(compute_client_v2: globus_sdk.ComputeClientV2): | ||
load_response(compute_client_v2.get_result_amqp_url) | ||
res = compute_client_v2.get_result_amqp_url() | ||
assert res.http_status == 200 | ||
assert "connection_url" in res.data |
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,16 @@ | ||
import globus_sdk | ||
from globus_sdk._testing import load_response | ||
|
||
|
||
def test_get_version(compute_client_v2: globus_sdk.ComputeClientV2): | ||
meta = load_response(compute_client_v2.get_version).metadata | ||
res = compute_client_v2.get_version() | ||
assert res.http_status == 200 | ||
assert res.data == meta["api_version"] | ||
|
||
|
||
def test_get_version_all(compute_client_v2: globus_sdk.ComputeClientV2): | ||
meta = load_response(compute_client_v2.get_version, case="all").metadata | ||
res = compute_client_v2.get_version(service="all") | ||
assert res.http_status == 200 | ||
assert res.data["api"] == meta["api_version"] |