File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright 2024 Cloudbase Solutions Srl
2
+ # All Rights Reserved.
3
+
4
+ from unittest import mock
5
+
6
+ from coriolisclient import client as coriolis_client
7
+ from coriolisclient .tests import test_base
8
+
9
+
10
+ class _HTTPClientTestCase (test_base .CoriolisBaseTestCase ):
11
+ """Test suite for the Coriolis HTTP Client."""
12
+
13
+ def test__init__ (self ):
14
+ session = mock .Mock ()
15
+ self .client = coriolis_client ._HTTPClient (
16
+ session , endpoint = mock .sentinel .endpoint , version = 'v0' )
17
+ self .assertEqual (
18
+ "%s/%s" % (mock .sentinel .endpoint , 'v0' ),
19
+ self .client .endpoint_override
20
+ )
21
+
22
+ def test__init__no_endpoint (self ):
23
+ session = mock .Mock ()
24
+ self .client = coriolis_client ._HTTPClient (session )
25
+ self .assertEqual (
26
+ None ,
27
+ self .client .endpoint_override
28
+ )
29
+
30
+
31
+ class ClientTestCase (test_base .CoriolisBaseTestCase ):
32
+ """Test suite for the Coriolis Client."""
33
+
34
+ @mock .patch .object (coriolis_client , "_HTTPClient" )
35
+ def test__init__ (self , mock_HTTPClient ):
36
+ try :
37
+ self .client = coriolis_client .Client (session = mock .sentinel .session )
38
+ except Exception :
39
+ self .fail ("Failed to initialize Client" )
40
+ mock_HTTPClient .assert_called_once_with (session = mock .sentinel .session )
You can’t perform that action at this time.
0 commit comments