Skip to content

Commit 7795394

Browse files
Enhancing list model api + config dependency removal
1 parent f62eb5d commit 7795394

File tree

3 files changed

+10
-44
lines changed

3 files changed

+10
-44
lines changed

tests/unitary/with_extras/aqua/test_cli.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -82,38 +82,6 @@ def test_aquacommand_flag(self, name, arg):
8282
with self.assertRaises(AquaCLIError):
8383
AquaCommand(**arg)
8484

85-
@parameterized.expand(
86-
[
87-
(
88-
"default",
89-
{"ODSC_MODEL_COMPARTMENT_OCID": ""},
90-
"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua.",
91-
),
92-
(
93-
"using jupyter instance",
94-
{
95-
"ODSC_MODEL_COMPARTMENT_OCID": "",
96-
"NB_SESSION_OCID": "nb-session-ocid",
97-
},
98-
"Aqua is not available for the notebook session nb-session-ocid. For more information, please refer to the documentation.",
99-
),
100-
]
101-
)
102-
def test_aqua_command_without_compartment_env_var(
103-
self, name, mock_env_dict, expected_msg
104-
):
105-
"""Test whether exit is called when ODSC_MODEL_COMPARTMENT_OCID is not set.
106-
Also check if NB_SESSION_OCID is set then log the appropriate message."""
107-
108-
with patch.dict(os.environ, mock_env_dict):
109-
reload(ads.config)
110-
reload(ads.aqua)
111-
reload(ads.aqua.cli)
112-
with self.assertRaises(AquaConfigError) as cm:
113-
AquaCommand()
114-
115-
self.assertEqual(str(cm.exception), expected_msg)
116-
11785
@patch("sys.argv", ["ads", "aqua", "--some-option"])
11886
@patch("ads.cli.serialize")
11987
@patch("fire.Fire")

tests/unitary/with_extras/aqua/test_common_handler.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ def test_get_ok(self):
4646
with patch(
4747
"ads.aqua.extension.base_handler.AquaAPIhandler.finish"
4848
) as mock_finish:
49-
with patch(
50-
"ads.aqua.extension.utils.fetch_service_compartment"
51-
) as mock_fetch_service_compartment:
52-
mock_fetch_service_compartment.return_value = (
53-
TestDataset.SERVICE_COMPARTMENT_ID
54-
)
55-
mock_finish.side_effect = lambda x: x
56-
self.common_handler.request.path = "aqua/hello"
57-
result = self.common_handler.get()
58-
assert result["status"] == "ok"
49+
mock_finish.side_effect = lambda x: x
50+
self.common_handler.request.path = "aqua/hello"
51+
result = self.common_handler.get()
52+
assert result["status"] == "ok"

tests/unitary/with_extras/aqua/test_model.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,11 +1452,15 @@ def test_list_service_models(self, mock_get_container_config):
14521452
]
14531453
)
14541454

1455-
results = self.app.list()
1455+
results = self.app.list(
1456+
compartment_id=TestDataset.SERVICE_COMPARTMENT_ID,
1457+
category=ads.config.SERVICE,
1458+
)
14561459

14571460
received_args = self.app.list_resource.call_args.kwargs
1461+
print("received_args: ", received_args)
14581462
assert received_args.get("compartment_id") == TestDataset.SERVICE_COMPARTMENT_ID
1459-
1463+
assert received_args.get("category") == ads.config.SERVICE
14601464
assert len(results) == 2
14611465

14621466
attributes = AquaModelSummary.__annotations__.keys()

0 commit comments

Comments
 (0)