Skip to content

Commit

Permalink
fix(client): add cloud config name check for "get_cloud_config"
Browse files Browse the repository at this point in the history
PR Closed: #898
  • Loading branch information
zhen.chen authored and AChenQ committed Aug 9, 2021
1 parent baacf00 commit 6b7d2ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions tensorbay/client/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def get_cloud_client(self, name: str) -> CloudClient:
Returns:
The cloud client of this dataset.
"""
self.get_auth_storage_config(name)
return CloudClient(name, self._client)

@overload
Expand Down
19 changes: 18 additions & 1 deletion tensorbay/client/tests/test_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,25 @@ def test_list_auth_storage_configs(self, mocker):

assert list(configs) == response_data["configs"]

def test_get_cloud_client(self):
def test_get_cloud_client(self, mocker):
config_name = "cloud_train"
response_data = {
"configs": [
{
"name": "cloud_train",
"type": "azure",
"accountName": "tensorbay",
"containerName": "tensorbay",
},
],
"offset": 0,
"recordSize": 1,
"totalCount": 1,
}
mocker.patch(
f"{gas.__name__}.Client.open_api_do",
return_value=mock_response(data=response_data),
)
cloud_client = self.gas_client.get_cloud_client(config_name)
cloud_client_1 = CloudClient(config_name, self.gas_client._client)
assert cloud_client._name == cloud_client_1._name
Expand Down

0 comments on commit 6b7d2ca

Please sign in to comment.