|
1 | 1 | #!/usr/bin/env python
|
2 | 2 | # -*- coding: utf-8 -*--
|
3 | 3 |
|
4 |
| -# Copyright (c) 2024 Oracle and/or its affiliates. |
| 4 | +# Copyright (c) 2025 Oracle and/or its affiliates. |
5 | 5 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
6 | 6 |
|
7 | 7 | import os
|
@@ -56,60 +56,3 @@ def test_get_ok(self):
|
56 | 56 | self.common_handler.request.path = "aqua/hello"
|
57 | 57 | result = self.common_handler.get()
|
58 | 58 | assert result["status"] == "ok"
|
59 |
| - |
60 |
| - def test_get_compatible_status(self): |
61 |
| - """Test to check if compatible is returned when ODSC_MODEL_COMPARTMENT_OCID is not set |
62 |
| - but CONDA_BUCKET_NS is one of the namespaces from the GA list.""" |
63 |
| - with patch.dict( |
64 |
| - os.environ, |
65 |
| - {"ODSC_MODEL_COMPARTMENT_OCID": "", "CONDA_BUCKET_NS": AQUA_GA_LIST[0]}, |
66 |
| - ): |
67 |
| - reload(ads.config) |
68 |
| - reload(ads.aqua) |
69 |
| - reload(ads.aqua.extension.utils) |
70 |
| - reload(ads.aqua.extension.common_handler) |
71 |
| - with patch( |
72 |
| - "ads.aqua.extension.base_handler.AquaAPIhandler.finish" |
73 |
| - ) as mock_finish: |
74 |
| - with patch( |
75 |
| - "ads.aqua.extension.utils.fetch_service_compartment" |
76 |
| - ) as mock_fetch_service_compartment: |
77 |
| - mock_fetch_service_compartment.return_value = None |
78 |
| - mock_finish.side_effect = lambda x: x |
79 |
| - self.common_handler.request.path = "aqua/hello" |
80 |
| - result = self.common_handler.get() |
81 |
| - assert result["status"] == "compatible" |
82 |
| - |
83 |
| - def test_raise_not_compatible_error(self): |
84 |
| - """Test to check if error is returned when ODSC_MODEL_COMPARTMENT_OCID is not set |
85 |
| - and CONDA_BUCKET_NS is not one of the namespaces from the GA list.""" |
86 |
| - with patch.dict( |
87 |
| - os.environ, |
88 |
| - {"ODSC_MODEL_COMPARTMENT_OCID": "", "CONDA_BUCKET_NS": "test-namespace"}, |
89 |
| - ): |
90 |
| - reload(ads.config) |
91 |
| - reload(ads.aqua) |
92 |
| - reload(ads.aqua.extension.utils) |
93 |
| - reload(ads.aqua.extension.common_handler) |
94 |
| - with patch( |
95 |
| - "ads.aqua.extension.base_handler.AquaAPIhandler.finish" |
96 |
| - ) as mock_finish: |
97 |
| - with patch( |
98 |
| - "ads.aqua.extension.utils.fetch_service_compartment" |
99 |
| - ) as mock_fetch_service_compartment: |
100 |
| - mock_fetch_service_compartment.return_value = None |
101 |
| - mock_finish.side_effect = lambda x: x |
102 |
| - self.common_handler.write_error = MagicMock() |
103 |
| - self.common_handler.request.path = "aqua/hello" |
104 |
| - self.common_handler.get() |
105 |
| - |
106 |
| - assert self.common_handler.write_error.call_args[1].get( |
107 |
| - "reason" |
108 |
| - ) == ( |
109 |
| - "The AI Quick actions extension is not " |
110 |
| - "compatible in the given region." |
111 |
| - ), "Incorrect error message." |
112 |
| - assert ( |
113 |
| - self.common_handler.write_error.call_args[1].get("status_code") |
114 |
| - == 404 |
115 |
| - ), "Incorrect status code." |
0 commit comments