Skip to content

Commit 3280f3b

Browse files
committed
🧪 Make type ignores granular @ tests
1 parent e9bcd0c commit 3280f3b

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

‎tests/credential_plugins_test.py‎

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# FIXME: the following violations must be addressed gradually and unignored
2-
# mypy: disable-error-code="no-untyped-call"
3-
41
from unittest import mock
52

63
import pytest
@@ -29,7 +26,7 @@ def test_hashivault_approle_auth() -> None:
2926
'role_id': 'the_role_id',
3027
'secret_id': 'the_secret_id',
3128
}
32-
res = hashivault.approle_auth(**kwargs)
29+
res = hashivault.approle_auth(**kwargs) # type: ignore[no-untyped-call]
3330
assert res == expected_res
3431

3532

@@ -43,7 +40,9 @@ def test_hashivault_kubernetes_auth() -> None:
4340
}
4441
with mock.patch('pathlib.Path') as path_mock:
4542
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+
)
4746
path_mock.assert_called_with(
4847
'/var/run/secrets/kubernetes.io/serviceaccount/token',
4948
)
@@ -57,7 +56,9 @@ def test_hashivault_client_cert_auth_explicit_role() -> None:
5756
expected_res = {
5857
'name': 'test-cert-1',
5958
}
60-
res = hashivault.client_cert_auth(**kwargs)
59+
res = hashivault.client_cert_auth( # type: ignore[no-untyped-call]
60+
**kwargs,
61+
)
6162
assert res == expected_res
6263

6364

@@ -66,22 +67,24 @@ def test_hashivault_client_cert_auth_no_role() -> None:
6667
expected_res = {
6768
'name': None,
6869
}
69-
res = hashivault.client_cert_auth(**kwargs)
70+
res = hashivault.client_cert_auth( # type: ignore[no-untyped-call]
71+
**kwargs,
72+
)
7073
assert res == expected_res
7174

7275

7376
def test_hashivault_userpass_auth() -> None:
7477
kwargs = {'username': 'the_username', 'password': 'the_password'}
7578
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]
7780
assert res == expected_res
7881

7982

8083
def test_hashivault_handle_auth_token() -> None:
8184
kwargs = {
8285
'token': 'the_token',
8386
}
84-
token = hashivault.handle_auth(**kwargs)
87+
token = hashivault.handle_auth(**kwargs) # type: ignore[no-untyped-call]
8588
assert token == kwargs['token']
8689

8790

@@ -92,7 +95,9 @@ def test_hashivault_handle_auth_approle() -> None:
9295
}
9396
with mock.patch.object(hashivault, 'method_auth') as method_mock:
9497
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+
)
96101
method_mock.assert_called_with(**kwargs, auth_param=kwargs)
97102
assert token == 'the_token'
98103

@@ -105,7 +110,9 @@ def test_hashivault_handle_auth_kubernetes() -> None:
105110
with mock.patch('pathlib.Path') as path_mock:
106111
mock.mock_open(path_mock.return_value.open, read_data='the_jwt')
107112
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+
)
109116
method_mock.assert_called_with(
110117
**kwargs,
111118
auth_param={
@@ -127,14 +134,16 @@ def test_hashivault_handle_auth_client_cert() -> None:
127134
}
128135
with mock.patch.object(hashivault, 'method_auth') as method_mock:
129136
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+
)
131140
method_mock.assert_called_with(**kwargs, auth_param=auth_params)
132141
assert token == 'the_token'
133142

134143

135144
def test_hashivault_handle_auth_not_enough_args() -> None:
136145
with pytest.raises(Exception):
137-
hashivault.handle_auth()
146+
hashivault.handle_auth() # type: ignore[no-untyped-call]
138147

139148

140149
class TestDelineaImports:
@@ -216,7 +225,7 @@ def test_aim_sensitive_traceback_masked(
216225
requests.exceptions.HTTPError,
217226
match=expected_url_in_exc,
218227
) as e:
219-
aim.aim_backend(
228+
aim.aim_backend( # type: ignore[no-untyped-call]
220229
url='http://testurl.com',
221230
app_id='foobar123',
222231
object_query='foobar123',

0 commit comments

Comments
 (0)