Marco Ricci commited on 2025-01-23 23:41:09
Zeige 4 geänderte Dateien mit 221 Einfügungen und 64 Löschungen.
... | ... |
@@ -288,17 +288,53 @@ class TestAllCLI: |
288 | 288 |
@pytest.mark.parametrize( |
289 | 289 |
['command', 'non_eager_arguments'], |
290 | 290 |
[ |
291 |
- ([], []), |
|
292 |
- ([], ['export']), |
|
293 |
- (['export'], []), |
|
294 |
- (['export'], ['vault']), |
|
295 |
- (['export', 'vault'], []), |
|
296 |
- (['export', 'vault'], ['--format', 'this-format-doesnt-exist']), |
|
297 |
- (['vault'], []), |
|
298 |
- (['vault'], ['--export', './']), |
|
291 |
+ pytest.param( |
|
292 |
+ [], |
|
293 |
+ [], |
|
294 |
+ id='top-nothing', |
|
295 |
+ ), |
|
296 |
+ pytest.param( |
|
297 |
+ [], |
|
298 |
+ ['export'], |
|
299 |
+ id='top-export', |
|
300 |
+ ), |
|
301 |
+ pytest.param( |
|
302 |
+ ['export'], |
|
303 |
+ [], |
|
304 |
+ id='export-nothing', |
|
305 |
+ ), |
|
306 |
+ pytest.param( |
|
307 |
+ ['export'], |
|
308 |
+ ['vault'], |
|
309 |
+ id='export-vault', |
|
310 |
+ ), |
|
311 |
+ pytest.param( |
|
312 |
+ ['export', 'vault'], |
|
313 |
+ [], |
|
314 |
+ id='export-vault-nothing', |
|
315 |
+ ), |
|
316 |
+ pytest.param( |
|
317 |
+ ['export', 'vault'], |
|
318 |
+ ['--format', 'this-format-doesnt-exist'], |
|
319 |
+ id='export-vault-args', |
|
320 |
+ ), |
|
321 |
+ pytest.param( |
|
322 |
+ ['vault'], |
|
323 |
+ [], |
|
324 |
+ id='vault-nothing', |
|
325 |
+ ), |
|
326 |
+ pytest.param( |
|
327 |
+ ['vault'], |
|
328 |
+ ['--export', './'], |
|
329 |
+ id='vault-args', |
|
330 |
+ ), |
|
299 | 331 |
], |
300 | 332 |
) |
301 |
- @pytest.mark.parametrize('arguments', [['--help'], ['--version']]) |
|
333 |
+ @pytest.mark.parametrize( |
|
334 |
+ 'arguments', |
|
335 |
+ [['--help'], ['--version']], |
|
336 |
+ ids=['help', 'version'], |
|
337 |
+ ) |
|
302 | 338 |
def test_200_eager_options( |
303 | 339 |
self, |
304 | 340 |
monkeypatch: pytest.MonkeyPatch, |
... | ... |
@@ -319,9 +355,21 @@ class TestAllCLI: |
319 | 355 |
result = tests.ReadableResult.parse(result_) |
320 | 356 |
assert result.clean_exit(empty_stderr=True), 'expected clean exit' |
321 | 357 |
|
322 |
- @pytest.mark.parametrize('no_color', [False, True]) |
|
323 |
- @pytest.mark.parametrize('force_color', [False, True]) |
|
324 |
- @pytest.mark.parametrize('isatty', [False, True]) |
|
358 |
+ @pytest.mark.parametrize( |
|
359 |
+ 'no_color', |
|
360 |
+ [False, True], |
|
361 |
+ ids=['yescolor', 'nocolor'], |
|
362 |
+ ) |
|
363 |
+ @pytest.mark.parametrize( |
|
364 |
+ 'force_color', |
|
365 |
+ [False, True], |
|
366 |
+ ids=['noforce', 'force'], |
|
367 |
+ ) |
|
368 |
+ @pytest.mark.parametrize( |
|
369 |
+ 'isatty', |
|
370 |
+ [False, True], |
|
371 |
+ ids=['notty', 'tty'], |
|
372 |
+ ) |
|
325 | 373 |
@pytest.mark.parametrize( |
326 | 374 |
['command_line', 'input'], |
327 | 375 |
[ |
... | ... |
@@ -330,6 +378,7 @@ class TestAllCLI: |
330 | 378 |
'{"services": {"": {"length": 20}}}', |
331 | 379 |
), |
332 | 380 |
], |
381 |
+ ids=['cmd'], |
|
333 | 382 |
) |
334 | 383 |
def test_201_no_color_force_color( |
335 | 384 |
self, |
... | ... |
@@ -761,7 +810,13 @@ class TestCLI: |
761 | 810 |
@pytest.mark.parametrize( |
762 | 811 |
['options', 'service', 'input', 'check_success'], |
763 | 812 |
[ |
764 |
- (o.options, o.needs_service, o.input, o.check_success) |
|
813 |
+ pytest.param( |
|
814 |
+ o.options, |
|
815 |
+ o.needs_service, |
|
816 |
+ o.input, |
|
817 |
+ o.check_success, |
|
818 |
+ id=' '.join(o.options), |
|
819 |
+ ) |
|
765 | 820 |
for o in INTERESTING_OPTION_COMBINATIONS |
766 | 821 |
if not o.incompatible |
767 | 822 |
], |
... | ... |
@@ -874,7 +929,7 @@ class TestCLI: |
874 | 929 |
@pytest.mark.parametrize( |
875 | 930 |
['options', 'service'], |
876 | 931 |
[ |
877 |
- (o.options, o.needs_service) |
|
932 |
+ pytest.param(o.options, o.needs_service, id=' '.join(o.options)) |
|
878 | 933 |
for o in INTERESTING_OPTION_COMBINATIONS |
879 | 934 |
if o.incompatible |
880 | 935 |
], |
... | ... |
@@ -1282,42 +1337,47 @@ contents go here |
1282 | 1337 |
@pytest.mark.parametrize( |
1283 | 1338 |
['command_line', 'input', 'result_config'], |
1284 | 1339 |
[ |
1285 |
- ( |
|
1340 |
+ pytest.param( |
|
1286 | 1341 |
['--phrase'], |
1287 | 1342 |
'my passphrase\n', |
1288 | 1343 |
{'global': {'phrase': 'my passphrase'}, 'services': {}}, |
1344 |
+ id='phrase', |
|
1289 | 1345 |
), |
1290 |
- ( |
|
1346 |
+ pytest.param( |
|
1291 | 1347 |
['--key'], |
1292 | 1348 |
'1\n', |
1293 | 1349 |
{ |
1294 | 1350 |
'global': {'key': DUMMY_KEY1_B64, 'phrase': 'abc'}, |
1295 | 1351 |
'services': {}, |
1296 | 1352 |
}, |
1353 |
+ id='key', |
|
1297 | 1354 |
), |
1298 |
- ( |
|
1355 |
+ pytest.param( |
|
1299 | 1356 |
['--phrase', '--', 'sv'], |
1300 | 1357 |
'my passphrase\n', |
1301 | 1358 |
{ |
1302 | 1359 |
'global': {'phrase': 'abc'}, |
1303 | 1360 |
'services': {'sv': {'phrase': 'my passphrase'}}, |
1304 | 1361 |
}, |
1362 |
+ id='phrase-sv', |
|
1305 | 1363 |
), |
1306 |
- ( |
|
1364 |
+ pytest.param( |
|
1307 | 1365 |
['--key', '--', 'sv'], |
1308 | 1366 |
'1\n', |
1309 | 1367 |
{ |
1310 | 1368 |
'global': {'phrase': 'abc'}, |
1311 | 1369 |
'services': {'sv': {'key': DUMMY_KEY1_B64}}, |
1312 | 1370 |
}, |
1371 |
+ id='key-sv', |
|
1313 | 1372 |
), |
1314 |
- ( |
|
1373 |
+ pytest.param( |
|
1315 | 1374 |
['--key', '--length', '15', '--', 'sv'], |
1316 | 1375 |
'1\n', |
1317 | 1376 |
{ |
1318 | 1377 |
'global': {'phrase': 'abc'}, |
1319 | 1378 |
'services': {'sv': {'key': DUMMY_KEY1_B64, 'length': 15}}, |
1320 | 1379 |
}, |
1380 |
+ id='key-length-sv', |
|
1321 | 1381 |
), |
1322 | 1382 |
], |
1323 | 1383 |
) |
... | ... |
@@ -1356,18 +1416,30 @@ contents go here |
1356 | 1416 |
@pytest.mark.parametrize( |
1357 | 1417 |
['command_line', 'input', 'err_text'], |
1358 | 1418 |
[ |
1359 |
- ( |
|
1419 |
+ pytest.param( |
|
1360 | 1420 |
[], |
1361 | 1421 |
'', |
1362 | 1422 |
'Cannot update the global settings without any given settings', |
1423 |
+ id='None', |
|
1363 | 1424 |
), |
1364 |
- ( |
|
1425 |
+ pytest.param( |
|
1365 | 1426 |
['--', 'sv'], |
1366 | 1427 |
'', |
1367 | 1428 |
'Cannot update the service-specific settings without any given settings', |
1429 |
+ id='None-sv', |
|
1430 |
+ ), |
|
1431 |
+ pytest.param( |
|
1432 |
+ ['--phrase', '--', 'sv'], |
|
1433 |
+ '', |
|
1434 |
+ 'No passphrase was given', |
|
1435 |
+ id='phrase-sv', |
|
1436 |
+ ), |
|
1437 |
+ pytest.param( |
|
1438 |
+ ['--key'], |
|
1439 |
+ '', |
|
1440 |
+ 'No SSH key was selected', |
|
1441 |
+ id='key-sv', |
|
1368 | 1442 |
), |
1369 |
- (['--phrase', '--', 'sv'], '', 'No passphrase was given'), |
|
1370 |
- (['--key'], '', 'No SSH key was selected'), |
|
1371 | 1443 |
], |
1372 | 1444 |
) |
1373 | 1445 |
def test_225_store_config_fail( |
... | ... |
@@ -2544,26 +2616,29 @@ Boo. |
2544 | 2616 |
@pytest.mark.parametrize( |
2545 | 2617 |
['command_line', 'config', 'result_config'], |
2546 | 2618 |
[ |
2547 |
- ( |
|
2619 |
+ pytest.param( |
|
2548 | 2620 |
['--delete-globals'], |
2549 | 2621 |
{'global': {'phrase': 'abc'}, 'services': {}}, |
2550 | 2622 |
{'services': {}}, |
2623 |
+ id='globals', |
|
2551 | 2624 |
), |
2552 |
- ( |
|
2625 |
+ pytest.param( |
|
2553 | 2626 |
['--delete', '--', DUMMY_SERVICE], |
2554 | 2627 |
{ |
2555 | 2628 |
'global': {'phrase': 'abc'}, |
2556 | 2629 |
'services': {DUMMY_SERVICE: {'notes': '...'}}, |
2557 | 2630 |
}, |
2558 | 2631 |
{'global': {'phrase': 'abc'}, 'services': {}}, |
2632 |
+ id='service', |
|
2559 | 2633 |
), |
2560 |
- ( |
|
2634 |
+ pytest.param( |
|
2561 | 2635 |
['--clear'], |
2562 | 2636 |
{ |
2563 | 2637 |
'global': {'phrase': 'abc'}, |
2564 | 2638 |
'services': {DUMMY_SERVICE: {'notes': '...'}}, |
2565 | 2639 |
}, |
2566 | 2640 |
{'services': {}}, |
2641 |
+ id='all', |
|
2567 | 2642 |
), |
2568 | 2643 |
], |
2569 | 2644 |
) |
... | ... |
@@ -332,9 +332,21 @@ class TestStoreroom: |
332 | 332 |
@pytest.mark.parametrize( |
333 | 333 |
['data', 'err_msg'], |
334 | 334 |
[ |
335 |
- ('{"version": 255}', 'bad or unsupported keys version header'), |
|
336 |
- ('{"version": 1}\nAAAA\nAAAA', 'trailing data; cannot make sense'), |
|
337 |
- ('{"version": 1}\nAAAA', 'cannot handle version 0 encrypted keys'), |
|
335 |
+ pytest.param( |
|
336 |
+ '{"version": 255}', |
|
337 |
+ 'bad or unsupported keys version header', |
|
338 |
+ id='v255', |
|
339 |
+ ), |
|
340 |
+ pytest.param( |
|
341 |
+ '{"version": 1}\nAAAA\nAAAA', |
|
342 |
+ 'trailing data; cannot make sense', |
|
343 |
+ id='trailing-data', |
|
344 |
+ ), |
|
345 |
+ pytest.param( |
|
346 |
+ '{"version": 1}\nAAAA', |
|
347 |
+ 'cannot handle version 0 encrypted keys', |
|
348 |
+ id='v0-keys', |
|
349 |
+ ), |
|
338 | 350 |
], |
339 | 351 |
) |
340 | 352 |
@pytest.mark.parametrize( |
... | ... |
@@ -491,8 +503,8 @@ class TestVaultNativeConfig: |
491 | 503 |
@pytest.mark.parametrize( |
492 | 504 |
['iterations', 'result'], |
493 | 505 |
[ |
494 |
- (100, b'6ede361e81e9c061efcdd68aeb768b80'), |
|
495 |
- (200, b'bcc7d01e075b9ffb69e702bf701187c1'), |
|
506 |
+ pytest.param(100, b'6ede361e81e9c061efcdd68aeb768b80', id='100'), |
|
507 |
+ pytest.param(200, b'bcc7d01e075b9ffb69e702bf701187c1', id='200'), |
|
496 | 508 |
], |
497 | 509 |
) |
498 | 510 |
def test_200_pbkdf2_manually(self, iterations: int, result: bytes) -> None: |
... | ... |
@@ -34,6 +34,7 @@ class TestStaticFunctionality: |
34 | 34 |
(val.public_key, val.public_key_data) |
35 | 35 |
for val in tests.SUPPORTED_KEYS.values() |
36 | 36 |
], |
37 |
+ ids=list(tests.SUPPORTED_KEYS.keys()), |
|
37 | 38 |
) |
38 | 39 |
def test_100_key_decoding( |
39 | 40 |
self, public_key: bytes, public_key_data: bytes |
... | ... |
@@ -46,52 +47,71 @@ class TestStaticFunctionality: |
46 | 47 |
@pytest.mark.parametrize( |
47 | 48 |
['line', 'env_name', 'value'], |
48 | 49 |
[ |
49 |
- ( |
|
50 |
+ pytest.param( |
|
50 | 51 |
'SSH_AUTH_SOCK=/tmp/pageant.user/pageant.27170; export SSH_AUTH_SOCK;', |
51 | 52 |
'SSH_AUTH_SOCK', |
52 | 53 |
'/tmp/pageant.user/pageant.27170', |
54 |
+ id='value-export-semicolon-pageant', |
|
53 | 55 |
), |
54 |
- ( |
|
56 |
+ pytest.param( |
|
55 | 57 |
'SSH_AUTH_SOCK=/tmp/ssh-3CSTC1W5M22A/agent.27270; export SSH_AUTH_SOCK;', |
56 | 58 |
'SSH_AUTH_SOCK', |
57 | 59 |
'/tmp/ssh-3CSTC1W5M22A/agent.27270', |
60 |
+ id='value-export-semicolon-openssh', |
|
58 | 61 |
), |
59 |
- ( |
|
62 |
+ pytest.param( |
|
60 | 63 |
'SSH_AUTH_SOCK=/tmp/pageant.user/pageant.27170; export SSH_AUTH_SOCK', |
61 | 64 |
'SSH_AUTH_SOCK', |
62 | 65 |
'/tmp/pageant.user/pageant.27170', |
66 |
+ id='value-export-pageant', |
|
63 | 67 |
), |
64 |
- ( |
|
68 |
+ pytest.param( |
|
65 | 69 |
'export SSH_AUTH_SOCK=/tmp/ssh-3CSTC1W5M22A/agent.27270;', |
66 | 70 |
'SSH_AUTH_SOCK', |
67 | 71 |
'/tmp/ssh-3CSTC1W5M22A/agent.27270', |
72 |
+ id='export-value-semicolon-openssh', |
|
68 | 73 |
), |
69 |
- ( |
|
74 |
+ pytest.param( |
|
70 | 75 |
'export SSH_AUTH_SOCK=/tmp/pageant.user/pageant.27170', |
71 | 76 |
'SSH_AUTH_SOCK', |
72 | 77 |
'/tmp/pageant.user/pageant.27170', |
78 |
+ id='export-value-pageant', |
|
73 | 79 |
), |
74 |
- ( |
|
80 |
+ pytest.param( |
|
75 | 81 |
'SSH_AGENT_PID=27170; export SSH_AGENT_PID;', |
76 | 82 |
'SSH_AGENT_PID', |
77 | 83 |
'27170', |
84 |
+ id='pid-export-semicolon', |
|
78 | 85 |
), |
79 |
- ( |
|
86 |
+ pytest.param( |
|
80 | 87 |
'SSH_AGENT_PID=27170; export SSH_AGENT_PID', |
81 | 88 |
'SSH_AGENT_PID', |
82 | 89 |
'27170', |
90 |
+ id='pid-export', |
|
83 | 91 |
), |
84 |
- ('export SSH_AGENT_PID=27170;', 'SSH_AGENT_PID', '27170'), |
|
85 |
- ('export SSH_AGENT_PID=27170', 'SSH_AGENT_PID', '27170'), |
|
86 |
- ( |
|
92 |
+ pytest.param( |
|
93 |
+ 'export SSH_AGENT_PID=27170;', |
|
94 |
+ 'SSH_AGENT_PID', |
|
95 |
+ '27170', |
|
96 |
+ id='export-pid-semicolon', |
|
97 |
+ ), |
|
98 |
+ pytest.param( |
|
99 |
+ 'export SSH_AGENT_PID=27170', |
|
100 |
+ 'SSH_AGENT_PID', |
|
101 |
+ '27170', |
|
102 |
+ id='export-pid', |
|
103 |
+ ), |
|
104 |
+ pytest.param( |
|
87 | 105 |
'export VARIABLE=value; export OTHER_VARIABLE=other_value;', |
88 | 106 |
'VARIABLE', |
89 | 107 |
None, |
108 |
+ id='export-too-much', |
|
90 | 109 |
), |
91 |
- ( |
|
110 |
+ pytest.param( |
|
92 | 111 |
'VARIABLE=value', |
93 | 112 |
'VARIABLE', |
94 | 113 |
None, |
114 |
+ id='no-export', |
|
95 | 115 |
), |
96 | 116 |
], |
97 | 117 |
) |
... | ... |
@@ -119,7 +139,7 @@ class TestStaticFunctionality: |
119 | 139 |
@pytest.mark.parametrize( |
120 | 140 |
['input', 'expected'], |
121 | 141 |
[ |
122 |
- (16777216, b'\x01\x00\x00\x00'), |
|
142 |
+ pytest.param(16777216, b'\x01\x00\x00\x00', id='16777216'), |
|
123 | 143 |
], |
124 | 144 |
) |
125 | 145 |
def test_210_uint32(self, input: int, expected: bytes | bytearray) -> None: |
... | ... |
@@ -129,11 +149,20 @@ class TestStaticFunctionality: |
129 | 149 |
@pytest.mark.parametrize( |
130 | 150 |
['input', 'expected'], |
131 | 151 |
[ |
132 |
- (b'ssh-rsa', b'\x00\x00\x00\x07ssh-rsa'), |
|
133 |
- (b'ssh-ed25519', b'\x00\x00\x00\x0bssh-ed25519'), |
|
134 |
- ( |
|
152 |
+ pytest.param( |
|
153 |
+ b'ssh-rsa', |
|
154 |
+ b'\x00\x00\x00\x07ssh-rsa', |
|
155 |
+ id='ssh-rsa', |
|
156 |
+ ), |
|
157 |
+ pytest.param( |
|
158 |
+ b'ssh-ed25519', |
|
159 |
+ b'\x00\x00\x00\x0bssh-ed25519', |
|
160 |
+ id='ssh-ed25519', |
|
161 |
+ ), |
|
162 |
+ pytest.param( |
|
135 | 163 |
ssh_agent.SSHAgentClient.string(b'ssh-ed25519'), |
136 | 164 |
b'\x00\x00\x00\x0f\x00\x00\x00\x0bssh-ed25519', |
165 |
+ id='string(ssh-ed25519)', |
|
137 | 166 |
), |
138 | 167 |
], |
139 | 168 |
) |
... | ... |
@@ -146,10 +175,15 @@ class TestStaticFunctionality: |
146 | 175 |
@pytest.mark.parametrize( |
147 | 176 |
['input', 'expected'], |
148 | 177 |
[ |
149 |
- (b'\x00\x00\x00\x07ssh-rsa', b'ssh-rsa'), |
|
150 |
- ( |
|
178 |
+ pytest.param( |
|
179 |
+ b'\x00\x00\x00\x07ssh-rsa', |
|
180 |
+ b'ssh-rsa', |
|
181 |
+ id='ssh-rsa', |
|
182 |
+ ), |
|
183 |
+ pytest.param( |
|
151 | 184 |
ssh_agent.SSHAgentClient.string(b'ssh-ed25519'), |
152 | 185 |
b'ssh-ed25519', |
186 |
+ id='ssh-ed25519', |
|
153 | 187 |
), |
154 | 188 |
], |
155 | 189 |
) |
... | ... |
@@ -167,8 +201,18 @@ class TestStaticFunctionality: |
167 | 201 |
@pytest.mark.parametrize( |
168 | 202 |
['value', 'exc_type', 'exc_pattern'], |
169 | 203 |
[ |
170 |
- (10000000000000000, OverflowError, 'int too big to convert'), |
|
171 |
- (-1, OverflowError, "can't convert negative int to unsigned"), |
|
204 |
+ pytest.param( |
|
205 |
+ 10000000000000000, |
|
206 |
+ OverflowError, |
|
207 |
+ 'int too big to convert', |
|
208 |
+ id='10000000000000000', |
|
209 |
+ ), |
|
210 |
+ pytest.param( |
|
211 |
+ -1, |
|
212 |
+ OverflowError, |
|
213 |
+ "can't convert negative int to unsigned", |
|
214 |
+ id='-1', |
|
215 |
+ ), |
|
172 | 216 |
], |
173 | 217 |
) |
174 | 218 |
def test_310_uint32_exceptions( |
... | ... |
@@ -181,7 +225,9 @@ class TestStaticFunctionality: |
181 | 225 |
@pytest.mark.parametrize( |
182 | 226 |
['input', 'exc_type', 'exc_pattern'], |
183 | 227 |
[ |
184 |
- ('some string', TypeError, 'invalid payload type'), |
|
228 |
+ pytest.param( |
|
229 |
+ 'some string', TypeError, 'invalid payload type', id='str' |
|
230 |
+ ), |
|
185 | 231 |
], |
186 | 232 |
) |
187 | 233 |
def test_311_string_exceptions( |
... | ... |
@@ -194,20 +240,29 @@ class TestStaticFunctionality: |
194 | 240 |
@pytest.mark.parametrize( |
195 | 241 |
['input', 'exc_type', 'exc_pattern', 'has_trailer', 'parts'], |
196 | 242 |
[ |
197 |
- (b'ssh', ValueError, 'malformed SSH byte string', False, None), |
|
198 |
- ( |
|
243 |
+ pytest.param( |
|
244 |
+ b'ssh', |
|
245 |
+ ValueError, |
|
246 |
+ 'malformed SSH byte string', |
|
247 |
+ False, |
|
248 |
+ None, |
|
249 |
+ id='unencoded', |
|
250 |
+ ), |
|
251 |
+ pytest.param( |
|
199 | 252 |
b'\x00\x00\x00\x08ssh-rsa', |
200 | 253 |
ValueError, |
201 | 254 |
'malformed SSH byte string', |
202 | 255 |
False, |
203 | 256 |
None, |
257 |
+ id='truncated', |
|
204 | 258 |
), |
205 |
- ( |
|
259 |
+ pytest.param( |
|
206 | 260 |
b'\x00\x00\x00\x04XXX trailing text', |
207 | 261 |
ValueError, |
208 | 262 |
'malformed SSH byte string', |
209 | 263 |
True, |
210 | 264 |
(b'XXX ', b'trailing text'), |
265 |
+ id='trailing-data', |
|
211 | 266 |
), |
212 | 267 |
], |
213 | 268 |
) |
... | ... |
@@ -293,6 +348,7 @@ class TestAgentInteraction: |
293 | 348 |
for value in tests.SUPPORTED_KEYS.values() |
294 | 349 |
] |
295 | 350 |
+ [(tests.list_keys_singleton()[0].key, True)], |
351 |
+ ids=[*tests.SUPPORTED_KEYS.keys(), 'singleton'], |
|
296 | 352 |
) |
297 | 353 |
def test_210_ssh_key_selector( |
298 | 354 |
self, |
... | ... |
@@ -389,6 +445,7 @@ class TestAgentInteraction: |
389 | 445 |
b'\x00\x00', |
390 | 446 |
b'\x00\x00\x00\x1f some bytes missing', |
391 | 447 |
], |
448 |
+ ids=['in-header', 'in-body'], |
|
392 | 449 |
) |
393 | 450 |
def test_310_truncated_server_response( |
394 | 451 |
self, |
... | ... |
@@ -415,23 +472,26 @@ class TestAgentInteraction: |
415 | 472 |
@pytest.mark.parametrize( |
416 | 473 |
['response_code', 'response', 'exc_type', 'exc_pattern'], |
417 | 474 |
[ |
418 |
- ( |
|
475 |
+ pytest.param( |
|
419 | 476 |
_types.SSH_AGENT.FAILURE, |
420 | 477 |
b'', |
421 | 478 |
ssh_agent.SSHAgentFailedError, |
422 | 479 |
'failed to complete the request', |
480 |
+ id='failed-to-complete', |
|
423 | 481 |
), |
424 |
- ( |
|
482 |
+ pytest.param( |
|
425 | 483 |
_types.SSH_AGENT.IDENTITIES_ANSWER, |
426 | 484 |
b'\x00\x00\x00\x01', |
427 | 485 |
EOFError, |
428 | 486 |
'truncated response', |
487 |
+ id='truncated-response', |
|
429 | 488 |
), |
430 |
- ( |
|
489 |
+ pytest.param( |
|
431 | 490 |
_types.SSH_AGENT.IDENTITIES_ANSWER, |
432 | 491 |
b'\x00\x00\x00\x00abc', |
433 | 492 |
ssh_agent.TrailingDataError, |
434 | 493 |
'Overlong response', |
494 |
+ id='overlong-response', |
|
435 | 495 |
), |
436 | 496 |
], |
437 | 497 |
) |
... | ... |
@@ -493,21 +553,23 @@ class TestAgentInteraction: |
493 | 553 |
'exc_pattern', |
494 | 554 |
], |
495 | 555 |
[ |
496 |
- ( |
|
556 |
+ pytest.param( |
|
497 | 557 |
b'invalid-key', |
498 | 558 |
True, |
499 | 559 |
_types.SSH_AGENT.FAILURE, |
500 | 560 |
b'', |
501 | 561 |
KeyError, |
502 | 562 |
'target SSH key not loaded into agent', |
563 |
+ id='key-not-loaded', |
|
503 | 564 |
), |
504 |
- ( |
|
565 |
+ pytest.param( |
|
505 | 566 |
tests.SUPPORTED_KEYS['ed25519'].public_key_data, |
506 | 567 |
True, |
507 | 568 |
_types.SSH_AGENT.FAILURE, |
508 | 569 |
b'', |
509 | 570 |
ssh_agent.SSHAgentFailedError, |
510 | 571 |
'failed to complete the request', |
572 |
+ id='failed-to-complete', |
|
511 | 573 |
), |
512 | 574 |
], |
513 | 575 |
) |
... | ... |
@@ -572,11 +634,12 @@ class TestAgentInteraction: |
572 | 634 |
@pytest.mark.parametrize( |
573 | 635 |
['request_code', 'response_code', 'exc_type', 'exc_pattern'], |
574 | 636 |
[ |
575 |
- ( |
|
637 |
+ pytest.param( |
|
576 | 638 |
_types.SSH_AGENTC.REQUEST_IDENTITIES, |
577 | 639 |
_types.SSH_AGENT.SUCCESS, |
578 | 640 |
ssh_agent.SSHAgentFailedError, |
579 | 641 |
f'[Code {_types.SSH_AGENT.IDENTITIES_ANSWER.value}]', |
642 |
+ id='REQUEST_IDENTITIES-expect-SUCCESS', |
|
580 | 643 |
), |
581 | 644 |
], |
582 | 645 |
) |
... | ... |
@@ -601,10 +664,17 @@ class TestAgentInteraction: |
601 | 664 |
@pytest.mark.parametrize( |
602 | 665 |
'response_data', |
603 | 666 |
[ |
604 |
- b'\xde\xad\xbe\xef', |
|
605 |
- b'\x00\x00\x00\x0fwrong extension', |
|
606 |
- b'\x00\x00\x00\x05query\xde\xad\xbe\xef', |
|
667 |
+ pytest.param(b'\xde\xad\xbe\xef', id='truncated'), |
|
668 |
+ pytest.param( |
|
669 |
+ b'\x00\x00\x00\x0fwrong extension', id='wrong-extension' |
|
670 |
+ ), |
|
671 |
+ pytest.param( |
|
672 |
+ b'\x00\x00\x00\x05query\xde\xad\xbe\xef', id='with-trailer' |
|
673 |
+ ), |
|
674 |
+ pytest.param( |
|
607 | 675 |
b'\x00\x00\x00\x05query\x00\x00\x00\x04ext1\x00\x00', |
676 |
+ id='with-extra-fields', |
|
677 |
+ ), |
|
608 | 678 |
], |
609 | 679 |
) |
610 | 680 |
def test_350_query_extensions_malformed_responses( |
611 | 681 |