1
- # FIXME: the following violations must be addressed gradually and unignored
2
- # mypy: disable-error-code="no-untyped-call"
3
-
4
1
from unittest import mock
5
2
6
3
import pytest
@@ -29,7 +26,7 @@ def test_hashivault_approle_auth() -> None:
29
26
'role_id' : 'the_role_id' ,
30
27
'secret_id' : 'the_secret_id' ,
31
28
}
32
- res = hashivault .approle_auth (** kwargs )
29
+ res = hashivault .approle_auth (** kwargs ) # type: ignore[no-untyped-call]
33
30
assert res == expected_res
34
31
35
32
@@ -43,7 +40,9 @@ def test_hashivault_kubernetes_auth() -> None:
43
40
}
44
41
with mock .patch ('pathlib.Path' ) as path_mock :
45
42
mock .mock_open (path_mock .return_value .open , read_data = 'the_jwt' )
46
- res = hashivault .kubernetes_auth (** kwargs )
43
+ res = hashivault .kubernetes_auth ( # type: ignore[no-untyped-call]
44
+ ** kwargs ,
45
+ )
47
46
path_mock .assert_called_with (
48
47
'/var/run/secrets/kubernetes.io/serviceaccount/token' ,
49
48
)
@@ -57,7 +56,9 @@ def test_hashivault_client_cert_auth_explicit_role() -> None:
57
56
expected_res = {
58
57
'name' : 'test-cert-1' ,
59
58
}
60
- res = hashivault .client_cert_auth (** kwargs )
59
+ res = hashivault .client_cert_auth ( # type: ignore[no-untyped-call]
60
+ ** kwargs ,
61
+ )
61
62
assert res == expected_res
62
63
63
64
@@ -66,22 +67,24 @@ def test_hashivault_client_cert_auth_no_role() -> None:
66
67
expected_res = {
67
68
'name' : None ,
68
69
}
69
- res = hashivault .client_cert_auth (** kwargs )
70
+ res = hashivault .client_cert_auth ( # type: ignore[no-untyped-call]
71
+ ** kwargs ,
72
+ )
70
73
assert res == expected_res
71
74
72
75
73
76
def test_hashivault_userpass_auth () -> None :
74
77
kwargs = {'username' : 'the_username' , 'password' : 'the_password' }
75
78
expected_res = {'username' : 'the_username' , 'password' : 'the_password' }
76
- res = hashivault .userpass_auth (** kwargs )
79
+ res = hashivault .userpass_auth (** kwargs ) # type: ignore[no-untyped-call]
77
80
assert res == expected_res
78
81
79
82
80
83
def test_hashivault_handle_auth_token () -> None :
81
84
kwargs = {
82
85
'token' : 'the_token' ,
83
86
}
84
- token = hashivault .handle_auth (** kwargs )
87
+ token = hashivault .handle_auth (** kwargs ) # type: ignore[no-untyped-call]
85
88
assert token == kwargs ['token' ]
86
89
87
90
@@ -92,7 +95,9 @@ def test_hashivault_handle_auth_approle() -> None:
92
95
}
93
96
with mock .patch .object (hashivault , 'method_auth' ) as method_mock :
94
97
method_mock .return_value = 'the_token'
95
- token = hashivault .handle_auth (** kwargs )
98
+ token = hashivault .handle_auth ( # type: ignore[no-untyped-call]
99
+ ** kwargs ,
100
+ )
96
101
method_mock .assert_called_with (** kwargs , auth_param = kwargs )
97
102
assert token == 'the_token'
98
103
@@ -105,7 +110,9 @@ def test_hashivault_handle_auth_kubernetes() -> None:
105
110
with mock .patch ('pathlib.Path' ) as path_mock :
106
111
mock .mock_open (path_mock .return_value .open , read_data = 'the_jwt' )
107
112
method_mock .return_value = 'the_token'
108
- token = hashivault .handle_auth (** kwargs )
113
+ token = hashivault .handle_auth ( # type: ignore[no-untyped-call]
114
+ ** kwargs ,
115
+ )
109
116
method_mock .assert_called_with (
110
117
** kwargs ,
111
118
auth_param = {
@@ -127,14 +134,16 @@ def test_hashivault_handle_auth_client_cert() -> None:
127
134
}
128
135
with mock .patch .object (hashivault , 'method_auth' ) as method_mock :
129
136
method_mock .return_value = 'the_token'
130
- token = hashivault .handle_auth (** kwargs )
137
+ token = hashivault .handle_auth ( # type: ignore[no-untyped-call]
138
+ ** kwargs ,
139
+ )
131
140
method_mock .assert_called_with (** kwargs , auth_param = auth_params )
132
141
assert token == 'the_token'
133
142
134
143
135
144
def test_hashivault_handle_auth_not_enough_args () -> None :
136
145
with pytest .raises (Exception ):
137
- hashivault .handle_auth ()
146
+ hashivault .handle_auth () # type: ignore[no-untyped-call]
138
147
139
148
140
149
class TestDelineaImports :
@@ -216,7 +225,7 @@ def test_aim_sensitive_traceback_masked(
216
225
requests .exceptions .HTTPError ,
217
226
match = expected_url_in_exc ,
218
227
) as e :
219
- aim .aim_backend (
228
+ aim .aim_backend ( # type: ignore[no-untyped-call]
220
229
url = 'http://testurl.com' ,
221
230
app_id = 'foobar123' ,
222
231
object_query = 'foobar123' ,
0 commit comments