@@ -20,6 +20,32 @@ def test_https_connection(req_session):
20
20
eq_ (call ['verify' ], False )
21
21
22
22
23
+ @patch ('requests.sessions.Session' )
24
+ def test_https_connection_wth_port_in_host (req_session ):
25
+ response = {'ticket' : 'ticket' ,
26
+ 'CSRFPreventionToken' : 'CSRFPreventionToken' }
27
+ req_session .request .return_value = response
28
+ ProxmoxAPI ('proxmox:123' , user = 'root@pam' , password = 'secret' , port = 124 , verify_ssl = False )
29
+ call = req_session .return_value .request .call_args [1 ]
30
+ eq_ (call ['url' ], 'https://proxmox:123/api2/json/access/ticket' )
31
+ eq_ (call ['data' ], {'username' : 'root@pam' , 'password' : 'secret' })
32
+ eq_ (call ['method' ], 'post' )
33
+ eq_ (call ['verify' ], False )
34
+
35
+
36
+ @patch ('requests.sessions.Session' )
37
+ def test_https_connection_wth_bad_port_in_host (req_session ):
38
+ response = {'ticket' : 'ticket' ,
39
+ 'CSRFPreventionToken' : 'CSRFPreventionToken' }
40
+ req_session .request .return_value = response
41
+ ProxmoxAPI ('proxmox:notaport' , user = 'root@pam' , password = 'secret' , port = 124 , verify_ssl = False )
42
+ call = req_session .return_value .request .call_args [1 ]
43
+ eq_ (call ['url' ], 'https://proxmox:124/api2/json/access/ticket' )
44
+ eq_ (call ['data' ], {'username' : 'root@pam' , 'password' : 'secret' })
45
+ eq_ (call ['method' ], 'post' )
46
+ eq_ (call ['verify' ], False )
47
+
48
+
23
49
class TestSuite ():
24
50
proxmox = None
25
51
serializer = None
0 commit comments