14
14
import ads .aqua
15
15
import ads .config
16
16
17
- from ads .aqua .extension .common_handler import CompatibilityCheckHandler
17
+ from ads .aqua .extension .common_handler import (
18
+ CompatibilityCheckHandler ,
19
+ AquaVersionHandler ,
20
+ )
18
21
19
22
20
23
class TestDataset :
21
24
SERVICE_COMPARTMENT_ID = "ocid1.compartment.oc1..<OCID>"
22
25
23
26
24
- class TestEvaluationHandler (unittest .TestCase ):
27
+ class TestCompatibilityCheckHandler (unittest .TestCase ):
25
28
@patch .object (IPythonHandler , "__init__" )
26
29
def setUp (self , ipython_init_mock ) -> None :
27
30
ipython_init_mock .return_value = None
28
31
self .common_handler = CompatibilityCheckHandler (MagicMock (), MagicMock ())
29
32
self .common_handler .request = MagicMock ()
30
33
31
34
def test_get_ok (self ):
32
- """Test to check if ok is returned when ODSC_MODEL_COMPARTMENT_OCID is set ."""
35
+ """Test to check if ok is returned."""
33
36
reload (ads .config )
34
37
reload (ads .aqua )
35
38
reload (ads .aqua .extension .utils )
@@ -42,3 +45,26 @@ def test_get_ok(self):
42
45
self .common_handler .request .path = "aqua/hello"
43
46
result = self .common_handler .get ()
44
47
assert result ["status" ] == "ok"
48
+
49
+
50
+ class TestAquaVersionHandler (unittest .TestCase ):
51
+ @patch .object (IPythonHandler , "__init__" )
52
+ def setUp (self , ipython_init_mock ) -> None :
53
+ ipython_init_mock .return_value = None
54
+ self .version_handler = AquaVersionHandler (MagicMock (), MagicMock ())
55
+ self .version_handler .request = MagicMock ()
56
+
57
+ @patch ("ads.common.utils.read_file" )
58
+ def test_get (self , mock_read_file ):
59
+ reload (ads .config )
60
+ reload (ads .aqua )
61
+ reload (ads .aqua .extension .utils )
62
+ reload (ads .aqua .extension .common_handler )
63
+ mock_read_file .return_value = '{"installed":{"aqua":"1.0.4","ads":"2.13.12"}}'
64
+ with patch (
65
+ "ads.aqua.extension.base_handler.AquaAPIhandler.finish"
66
+ ) as mock_finish :
67
+ mock_finish .side_effect = lambda x : x
68
+ self .version_handler .request .path = "aqua/aqua_version"
69
+ result = self .version_handler .get ()
70
+ assert result == {"installed" : {"aqua" : "1.0.4" , "ads" : "2.13.12" }}
0 commit comments