Enable some more bandit checks (#30857)

* Enable B108 (hardcoded tmp dir), address findings

* Enable B602 (subprocess popen with shell), address findings

* Enable B604 (start process with shell), address findings

* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
This commit is contained in:
Ville Skyttä authored and GitHub committed 2020-01-20 18:44:55 +02:00
1 parent 6cf20fc7fa
commit 5e2ba2eb77
21 files changed
+110 -91

No files matched your search

+5 -5
View File
@@ -55,7 +55,7 @@ def minio_client_event_fixture():
async def test_minio_services(hass, caplog, minio_client):
"""Test Minio services."""
hass.config.whitelist_external_dirs = set("/tmp")
hass.config.whitelist_external_dirs = set("/test")
await async_setup_component(
hass,
@@ -80,22 +80,22 @@ async def test_minio_services(hass, caplog, minio_client):
await hass.services.async_call(
DOMAIN,
"put",
{"file_path": "/tmp/some_file", "key": "some_key", "bucket": "some_bucket"},
{"file_path": "/test/some_file", "key": "some_key", "bucket": "some_bucket"},
blocking=True,
)
assert minio_client.fput_object.call_args == call(
"some_bucket", "some_key", "/tmp/some_file"
"some_bucket", "some_key", "/test/some_file"
)
minio_client.reset_mock()
await hass.services.async_call(
DOMAIN,
"get",
{"file_path": "/tmp/some_file", "key": "some_key", "bucket": "some_bucket"},
{"file_path": "/test/some_file", "key": "some_key", "bucket": "some_bucket"},
blocking=True,
)
assert minio_client.fget_object.call_args == call(
"some_bucket", "some_key", "/tmp/some_file"
"some_bucket", "some_key", "/test/some_file"
)
minio_client.reset_mock()