(self)
| 316 | @unittest.skipUnless(hasattr(os, 'getuid'), "os.getuid is required") |
| 317 | @os_helper.skip_unless_working_chmod |
| 318 | def test_security_only_once(self): |
| 319 | # Make sure security check is only run once per parse when multiple |
| 320 | # entries are found. |
| 321 | with patch.object(netrc.netrc, "_security_check") as mock: |
| 322 | with os_helper.temp_dir() as tmp_dir: |
| 323 | netrc_path = Path(tmp_dir) / '.netrc' |
| 324 | netrc_path.write_text("""\ |
| 325 | machine foo.domain.com login bar password pass |
| 326 | machine bar.domain.com login foo password pass |
| 327 | """) |
| 328 | netrc_path.chmod(0o600) |
| 329 | with os_helper.EnvironmentVarGuard() as environ: |
| 330 | environ.set('HOME', tmp_dir) |
| 331 | netrc.netrc() |
| 332 | |
| 333 | mock.assert_called_once() |
| 334 | |
| 335 | |
| 336 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected