1
1
//! Integration tests for API access methods.
2
2
use super :: { Error , TestContext } ;
3
3
use mullvad_management_interface:: MullvadProxyClient ;
4
+ use talpid_types:: net:: proxy:: CustomProxy ;
4
5
use test_macro:: test_function;
5
6
use test_rpc:: ServiceClient ;
6
7
@@ -26,13 +27,12 @@ pub async fn test_custom_access_methods(
26
27
log:: info!( "Testing Shadowsocks access method" ) ;
27
28
test_shadowsocks ( mullvad_client. clone ( ) ) . await ?;
28
29
log:: info!( "Testing SOCKS5 (Remote) access method" ) ;
29
- test_socks_remote ( ) . await ?;
30
+ test_socks_remote ( mullvad_client . clone ( ) ) . await ?;
30
31
Ok ( ( ) )
31
32
}
32
33
33
34
async fn test_shadowsocks ( mut mullvad_client : MullvadProxyClient ) -> Result < ( ) , Error > {
34
35
use mullvad_types:: relay_list:: RelayEndpointData ;
35
- use talpid_types:: net:: proxy:: CustomProxy ;
36
36
// Set up all the parameters needed to create a custom Shadowsocks access method.
37
37
//
38
38
// Since Mullvad host's Shadowsocks relays on their bridge servers, we can
@@ -54,6 +54,32 @@ async fn test_shadowsocks(mut mullvad_client: MullvadProxyClient) -> Result<(),
54
54
} )
55
55
. expect ( "`test_shadowsocks` needs at least one shadowsocks relay to execute. Found non in relay list." ) ;
56
56
57
+ assert_access_method_works ( mullvad_client, access_method. clone ( ) ) . await ?;
58
+
59
+ Ok ( ( ) )
60
+ }
61
+
62
+ async fn test_socks_remote ( mut mullvad_client : MullvadProxyClient ) -> Result < ( ) , Error > {
63
+ use talpid_types:: net:: proxy:: Socks5Remote ;
64
+ // Set up all the parameters needed to create a custom SOCKS5 access method.
65
+ //
66
+ // The remote SOCKS5 proxy is assumed to be running on the test manager.
67
+ // On which port it listens to is defined in the test config.
68
+ let endpoint = todo ! ( ) ;
69
+ let access_method = Socks5Remote {
70
+ endpoint : todo ! ( ) ,
71
+ auth : None ,
72
+ } ;
73
+
74
+ assert_access_method_works ( mullvad_client, access_method. into ( ) ) . await ?;
75
+
76
+ Ok ( ( ) )
77
+ }
78
+
79
+ async fn assert_access_method_works (
80
+ mut mullvad_client : MullvadProxyClient ,
81
+ access_method : CustomProxy ,
82
+ ) -> Result < ( ) , Error > {
57
83
let successful = mullvad_client
58
84
. test_custom_api_access_method ( access_method. clone ( ) . into ( ) )
59
85
. await ?;
@@ -65,8 +91,3 @@ async fn test_shadowsocks(mut mullvad_client: MullvadProxyClient) -> Result<(),
65
91
66
92
Ok ( ( ) )
67
93
}
68
-
69
- #[ allow( clippy:: unused_async) ]
70
- async fn test_socks_remote ( ) -> Result < ( ) , Error > {
71
- unimplemented ! ( "Testing SOCKS5 (Remote) access method is not implemented" )
72
- }
0 commit comments