10
10
11
11
import os
12
12
13
+ from .authproxy import AuthServiceProxy
13
14
14
15
REFERENCE_FILENAME = 'rpc_interface.txt'
15
16
@@ -19,24 +20,25 @@ class AuthServiceProxyWrapper():
19
20
An object that wraps AuthServiceProxy to record specific RPC calls.
20
21
21
22
"""
22
- def __init__ (self , auth_service_proxy_instance , coverage_logfile = None ):
23
+ def __init__ (self , auth_service_proxy_instance : AuthServiceProxy , rpc_url : str , coverage_logfile : str = None ):
23
24
"""
24
25
Kwargs:
25
- auth_service_proxy_instance (AuthServiceProxy) : the instance
26
- being wrapped.
27
- coverage_logfile (str) : if specified, write each service_name
26
+ auth_service_proxy_instance: the instance being wrapped.
27
+ rpc_url: url of the RPC instance being wrapped
28
+ coverage_logfile: if specified, write each service_name
28
29
out to a file when called.
29
30
30
31
"""
31
32
self .auth_service_proxy_instance = auth_service_proxy_instance
33
+ self .rpc_url = rpc_url
32
34
self .coverage_logfile = coverage_logfile
33
35
34
36
def __getattr__ (self , name ):
35
37
return_val = getattr (self .auth_service_proxy_instance , name )
36
38
if not isinstance (return_val , type (self .auth_service_proxy_instance )):
37
39
# If proxy getattr returned an unwrapped value, do the same here.
38
40
return return_val
39
- return AuthServiceProxyWrapper (return_val , self .coverage_logfile )
41
+ return AuthServiceProxyWrapper (return_val , self .rpc_url , self . coverage_logfile )
40
42
41
43
def __call__ (self , * args , ** kwargs ):
42
44
"""
@@ -57,6 +59,7 @@ def _log_call(self):
57
59
58
60
def __truediv__ (self , relative_uri ):
59
61
return AuthServiceProxyWrapper (self .auth_service_proxy_instance / relative_uri ,
62
+ self .rpc_url ,
60
63
self .coverage_logfile )
61
64
62
65
def get_request (self , * args , ** kwargs ):
@@ -74,18 +77,18 @@ def get_filename(dirname, n_node):
74
77
dirname , "coverage.pid%s.node%s.txt" % (pid , str (n_node )))
75
78
76
79
77
- def write_all_rpc_commands (dirname , node ) :
80
+ def write_all_rpc_commands (dirname : str , node : AuthServiceProxy ) -> bool :
78
81
"""
79
82
Write out a list of all RPC functions available in `bitcoin-cli` for
80
83
coverage comparison. This will only happen once per coverage
81
84
directory.
82
85
83
86
Args:
84
- dirname (str) : temporary test dir
85
- node (AuthServiceProxy) : client
87
+ dirname: temporary test dir
88
+ node: client
86
89
87
90
Returns:
88
- bool. if the RPC interface file was written.
91
+ if the RPC interface file was written.
89
92
90
93
"""
91
94
filename = os .path .join (dirname , REFERENCE_FILENAME )
0 commit comments